I'm having an issue with Angular 2 (using Alpha 35) where I'm updating the data used by ng-for, but the HTML page doesn't refresh until the user does something to interact with it. I'm wondering if this is an Angular 2 bug, or something I'm not doing correctly. (Probably the latter.)
I've got a plnkr demonstrating the issue: http://plnkr.co/edit/6ZQeLgLIWwzUSL4rxNv5?p=preview Enter an item or two in the field, and click "Add Todo". Then click "Choose File", select some text file on your hard drive, and then click "Load selected file". At this point, notice thie code is calling the callback provided here: loadButtonPushed() { var _this = this; this.loadFileAsText( fileToLoad, function(data) { console.log("hi"); _this.todos = []; }); } This is where I'm not sure I'm doing the 'right thing'. Notice that I'm using _this to keep track of the context, so I can get the correct context from inside the callback. This method works for me in other scenarios though, so maybe it has nothing to do with the issue. Anyway, when you click Load Selected File, notice that the todos list gets erased. However, the web page *does not update* right away. You'll have to interact with it to get it to update, perhaps by clicking in the Add Todo text field and typing some text. THEN the list will erase. I'm having a similar issue in a different project, where the user has to click a button to get the HTML to update. Minor notes: You'll notice I commented out a "window.setTimeout" that erases _this.todos as well, to see if that would duplicate the issue, since a callback is involved. It did not. This Plunkr uses Alpha 34 but I'm using 35 on my local machine and having the same issue. (Not using latest since I need TypeScript Definition files, and those haven't caught up with the latest release yet.) -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
