简体   繁体   中英

aurelia view-model properties inside a promise “then” function

I'm trying to access my view-model properties and bindings into a "then" function of a promise just like this :

let that = this;
this.getDate().then(data => {
    that.binding.style.backgroundColor = "white";
    console.log(that.property);
});

The thing is "this" is undefined so how am I supposed to get those?

当我应该尝试读取的变量是_this5时,我的错误是试图在调试器中读取“ this”,该变量是由babel transpiller为ES5创建的。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM