我無法綁定全局變量。在angularjs中使用addListener進行雙向綁定2
在這裏我的代碼。
mxEvent.addListener(img, 'click',
mxUtils.bind(this, function(evt:any) {
this.enableRightSideBar = true;
console.log(this.enableRightSideBar);
}.bind(this))
)
console.log(this.enableRightSideBar, 'this.enableRightSideBar');
顯示「true」,但它不反映在html上。
請幫幫我。
請提供更多的上下文。在Angular2中你有這個代碼嗎? 「mxUtils」在什麼地方? –
mxUtils是mxgraph類 –
@GünterZöchbauer 我想這也: mxEvent.addListener(IMG, '點擊',功能(事件:任意){ this.enableRightSideBar = TRUE; }) 不是爲我工作。 –