Angular2, view not updating after variable changes in settimeout
As Vlado said, it should work ;-)
I think that the angular2-polyfills.js
library should be included into your page. I can't see it. This file is essentially a mashup of zone.js and reflect-metadata. Zones take part of the detection of updates.
You could have a look at this video where Bryan Ford explains what it is: https://www.youtube.com/watch?v=3IqtmUscE_U.
Hope it helps you,Thierry
That should work. Do you have any other errors in console?
@Component({ selector: 'my-app', template: `<h1>Hello {{title}}</h1>`})export class App { public title: string = "World"; constructor() { setTimeout(() => { this.title = "Brave New World" }, 1000);) }}
Look at this Plunker:http://plnkr.co/edit/XaL4GoqFd9aisOYIhuXq?p=preview
I had a very similar problem to the OP where even in a basic Angular2 setup changes to bound properties would not be reflected by the view automatically. At this point in time we're using Angular2 2.0.0-rc.6.There was no error message.
In the end I found the culprit to be a reference to es6-promise.js, which was 'required' by a third party component we use. Somehow this interfered with the core-js reference we are using which is suggested with rc6 in some of the Angular2 tutorials.
As soon as I got rid of the es6-promise.js reference, the view updated correctly after changing a property on my component (via Promise or timeout).
Hope this helps somebody some day.