Typescript async/await doesnt update AngularJS view

前端 未结 10 500
小鲜肉
小鲜肉 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:53

    I would write a converter function, in some generic factory (didnt tested this code, but should be work)

    function toNgPromise(promise)
    {
        var defer = $q.defer();
        promise.then((data) => {
            $q.resolve(data);
        }).catch(response)=> {
            $q.reject(response);
        });
    
        return defer.promise;
    }
    

    This is just to get you started, though I assume conversion in the end will not be as simple as this...

提交回复
热议问题