Id selected in Angularjs ng-repeat -
i have angularjs code in navigate through collection of values :
<ul class="bullet-list" ng-repeat="item in data track item.id" > <li><a ng-mouseover="selectedid()" ng-model="item.id" href="{{item.url}}"> {{item.software}}</a></li> </ul> in controller code :
$scope.selectedid = function(){ alert($scope.item.id); }; but there's error when runs : $scope.item undefined
could guys me ?
do:
ng-mouseover="selectedid(item)" and then:
$scope.selectedid = function(item){ alert(item.id); }; this pass $scope.item $scope.selectedid function since item bound scope. changes make item inside of function therefore reflected in view.
Comments
Post a Comment