angularjs - Angular 2 this.generateTree is not a function -
i have 2 functions in component. onelementclick binded element in html. every time click on element, get:
this.showhalo not function
why case?
showhalo(view, opt) { // code } onelementclick(view) { // code function click() { this.showhalo(view, { animation: true }); } }
i tried this, same thing.
myfunc(){ console.log("test"); } onelementclick(view) { self = this; self.myfunc(); }
correct this
pointer. :
showhalo(view, opt) { // code } onelementclick(view) { // code var _this = this; function click() { _this.showhalo(view, { animation: true }); } }
Comments
Post a Comment