javascript - Combine ng-repeat and ng-click -
i building angularjs app using ng-repeat , ng-click on same element. have array of items run through create list of buttons. each 1 of these items has property category i'd pass argument ng-click action.
so far have used following code:
<button type="button" class="btn btn-default" ng-repeat="job in jobs" ng-click="filterjoblistings(job.category)"> {{ job.category }} </button> however, generated html follows:
<button type="button" class="btn btn-default ng-scope ng-binding" ng-repeat="job in jobs" ng-click="filterjoblistings(job.category)">design</button> how can pass argument correctly here?
thanks lot,
cheers
edit wrong, ng-click="filterjoblistings({{job.category}})" not solution
i believe you're doing correctly. issue prototypical inheritance. remember, ng-repeat creates own scopes might not apply changes parent scope(s).
see fiddle works. notice i'm using , object store selected category $scope.obj.cat=i;. wouldn't work if used primitive.
Comments
Post a Comment