简体   繁体   English

promise“ then”函数内部的aurelia视图模型属性

[英]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 : 我正在尝试将我的视图模型属性和绑定访问到promise的“ then”函数中,如下所示:

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创建的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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