Angular6 this pointing to the problem

students, I have a question to ask you. Our current project technology stack is ng6+ts,. The problem now is that there is a problem when using the ztree plug-in:

ztree configuration

  /**
   * ztree 
   */
      setting: any = {
              data:{
                    simpleData:{
                        enable:true
                    },
                    key:{
                        name:"des"
                    }
                },
        check: {
            enable: true
        },
        view: {
            showLine: true,
            showIcon: false
        },
        callback: {
            onClick: this.onClick,
            onCheck: function (e, treeId, treeNode) {
                console.info(treeNode);
            }
        }
    }
    private onClick(event, treeId, treeNode, clickFlag){
        this.httpcl.get(`http:localhost:8080/shinyview/draft/ColumValueDraft/${treeId}`,{}).subscribe((res) => {console.log(res)})

-sharp-sharp-sharpconstructor configuration-sharp-sharp-sharp

 constructor(private appService: AppService,
                            private http: HttpService, 
                            public httpcl:HttpClient,
                            private toastService: ToastService) {
    }
ztreesettingcallbackonClickthis.onClickztreetreeIdonClickthis:

,
cannot call httpClient . Has any god encountered similar problems ? The method of new does not solve

.
Apr.23,2021

excuse me, has the problem been solved? I have the same problem.


in the onClick method reference, add bind (this) , the specific code is as follows:

 callback: {
            onClick: this.onClick.bind(this),
            onCheck: function (e, treeId, treeNode) {
                console.info(treeNode);
            }
        }
  • Why localstorage can't save ts's map

    let menu = new Map<string,Menu>; localStorage.setItem( menu , JSON.stringify(menu)); then look at the localStorage in the Application of the browser, and the corresponding value of menu is {} . ...

    Mar.23,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2b5c2-2ba82.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2b5c2-2ba82.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?