I would like to get current item from ng-repeat (like ng-model)
<div data-ng-controller="WidgetCtrl">
<ul>
<li data-ng-repeat="widget in widgets">
ID {{widget.ID}}: {{widget.Color}} {{widget.Shape}}
</li>
</ul>
</div>
<div>Current Widget = <span ng-bind="{{widget.ID}}"></span></div>
How to update (observable) the Current Widget
Regards
Hi. Thanks you. I would like to retrive Current item and display it outside of looping.
Regards.
--
You received this message because you are subscribed to a topic in the Google Groups "AngularJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/angular/Rkc0tXZhpWk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.
<div data-ng-controller="WidgetCtrl as wdgt">
<ul>
<li data-ng-repeat="widget in widgets" ng-click='wdgt.active = widget>
ID {{widget.ID}}: {{widget.Color}} {{widget.Shape}}
</li>
</ul>
Hope this helps a bit ;)
regards
Sander
foreach (var widget in widgets)
{
CurrentWidget = widget;
}