Took a quick look at your Plunk and I think the way you use the promise if 
a bit off
In a sense, I'd be ready to say that no way is wrong, but I'm just not too 
sure about it for now

You never should have to chain .then() in your template, it just doesn't 
make sense to me
Also, but this is mostly a preference I have, I'd rather not bind a promise 
to the template directly, or even a factory, but that's "me"

It is important to note that previous versions of Angular supported binding 
a promise directly in the template and it was automatically unwrapping the 
promise for you, this showing the result in the template, but this isn't 
true anymore. That's just one more reason not to bind a promise to the Tpl.

The method you call from the template should live on the $scope created by 
your controller, and let that method do the work it needs and interect with 
your factory/promises and what not. When the promise is resolved, then you 
update whatever you need on the $scope object so it's reflected in your UI

Here's a fork of your Plunk that shows what I mean, using both $timeout and 
setTimeout:
Hope this help!

http://plnkr.co/edit/5PhRC9?p=preview

Cheers!

On Wednesday, January 15, 2014 6:47:14 AM UTC-5, Sander Elias wrote:
>
> Hi All, 
>
> I was working on a project and got some strange behaviour. (In retrospect, 
> it wasn't!)
> While using promises, and my UI updates didn't follow as I would have 
> expected. So I stepped out, and created an plunk to isolate the issue, as 
> that's what I do if I want to sort stuff out.
> While building the plunk I realized that a promise.then() will cause an 
> digest/apply, and that was the solution to my problem.
>
> I left the plunk <http://goo.gl/7yLovJ>for future reference.
> Perhaps that somebody else can use it as an simple promise sample, or some 
> other use!
>
> Regards
> Sander
>
>

-- 
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/groups/opt_out.

Reply via email to