Angular: ng-repeat scope - 14410993
http://angularjs.org/
HTML
<div ng-controller="MyCtrl">
<div ng-repeat="person in persons | filter:noZeroQuantity">
<span ng-bind="person.name"></span>
<span ng-bind="person.quantity"></span>
</div>
</div>
JavaScript
var myApp = angular.module('myApp', []);
//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});
function MyCtrl($scope) {
$scope.noZeroQuantity = function(value, index, array) {
console.log(value, index, array);
return value.quantity !== 0
}
$scope.persons = [
{
id: 0,
name: "Bart",
quantity: 10
},
{
id: 1,
name: "Bert",
quantity: 0
},
{
id: 2,
name: "Bort",
quantity: 20
},
];
}