Re: [angular.js] view not updating on $scope.modelName = someValue;

Showing 1-5 of 5 messages
Re: [angular.js] view not updating on $scope.modelName = someValue; Suller Andras 6/9/12 9:52 PM
Hi,

Is looks like $scope.$apply solves the issue:
http://jsfiddle.net/GJJMT/13/

Andras

On Sun, Jun 10, 2012 at 10:47 AM, Joel Holdbrooks
<cjhold...@gmail.com> wrote:
> I've spent a bit of time trying to figure this one out, I'm hoping someone
> out there can help clue me in to whats missing.
>
> Here's the fiddle:
>
> http://jsfiddle.net/cjholdbrooks/GJJMT/9/
>
> Basically I have a directive (snippet), a service (tokenService), a
> controller (TokenCtrl), and some code which has been run through CodeRay (a
> syntax highlighter). Whenever someone clicks on one of the "tokens" in the
> code (ie. a span) I would like to see the name of the token displayed. I'm
> trying to figure out why the binding tokenName doesn't update in the view
> when it's changed. If you open the console, it shows everything is working
> fine.
>
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/angular/-/LLLd9KYbGUYJ.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to
> angular+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/angular?hl=en.
Re: [angular.js] view not updating on $scope.modelName = someValue; Dan Doyon 6/9/12 10:19 PM
I came up with a slightly different way but essentially the same


--dan



On Jun 9, 2012, at 10:08 PM, Joel Holdbrooks wrote:

Thanks so much! I really appreciate the help! To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/vig6azFWWzsJ.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Re: [angular.js] view not updating on $scope.modelName = someValue; Igor Minar 6/19/12 1:17 PM
I looked at this and I actually think that you are not thinking about the solution correctly.

Forget events, in angular scope events should be used only in very special cases when data-binding is not suitable.

Instead, embrace data-binding whenever possible: http://jsfiddle.net/IgorMinar/zw6dw/8/

/i

On Sun, Jun 10, 2012 at 8:28 PM, Joel Holdbrooks <cjhold...@gmail.com> wrote:
Ah, very nice. I like this approach as well. There's so much packed in to angular, it's nice to have such a helpful community, thanks! To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/r46aA4jM1t4J.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Re: [angular.js] view not updating on $scope.modelName = someValue; Dan Doyon 6/19/12 1:30 PM
nice!


From: Igor Minar <ig...@angularjs.org>
To: ang...@googlegroups.com
Sent: Tuesday, June 19, 2012 1:17 PM
Subject: Re: [angular.js] view not updating on $scope.modelName = someValue;
Re: [angular.js] Re: view not updating on $scope.modelName = someValue; Vojta Jína 6/30/12 5:38 PM
$$phase is either '$apply' or '$digest' or null

So yep, if (!scope.$$phase) scope.$apply() will work. Although, it's highly recommended to to not have code being executed sometimes within apply and sometimes outside.

V.


On Thu, Jun 21, 2012 at 10:10 PM, ItsLeeOwen <l...@coderebelbase.com> wrote:
Sorry typo, I believe you should only run a digest if $scope.$$phase is false. if( !$scope.$$phase ).  I'll double check later.


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/PFqGqhiudccJ.

To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.