Typescript async/await doesnt update AngularJS view

前端 未结 10 510
小鲜肉
小鲜肉 2020-12-01 09:17

I\'m using Typescript 2.1(developer version) to transpile async/await to ES5.

I\'ve noticed that after I change any property which is bound to view in my async funct

10条回答
  •  不思量自难忘°
    2020-12-01 09:50

    As @basarat said the native ES6 Promise doesn't know about the digest cycle. You should to promise

    async testAsync() {
     await this.$timeout(2000).toPromise()
          .then(response => this.text = "Changed");
     }
    

提交回复
热议问题