<li ng-repeat="n in [1,2,3]"><button ng-click="$root.count = $root.count +
n">{{n}}</li>
On Tuesday, June 26, 2012 at 3:12:37 AM UTC+1, [email protected] wrote:
>
> I just want the following to *work*:
>
> <!doctype html>
> <html ng-app>
> <head> <script src="http://code.angularjs.org/angular-1.0.1.min.js"></script>
> </head>
> <body>
> <span ng-init="count=0">count: {{count}}</span>
>
> <ul>
> <li ng-repeat="n in [1,2,3]"><button ng-click="count = count +
> n">{{n}}</li>
> </ul>
> </body>
> </html>
>
> Pressing the buttons does not affect count (or at least not the count
> being displayed), because count is in the root-scope and the buttons are
> in the ng-repeat scope. So... how do I fix it in the obvious ways.
>
>
--
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.