AngularJS Example
by vinodlouis
HTML
<div ng-app="">
<div ng-controller="me" ng-init="friends = [{name:'John', age:25}, {name:'Mary', age:28}]">
I have {{friends.length}} friends. They are:
<ul>
<li ng-repeat="friend in friends | filter:call(friends);">
[{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
</li>
</ul>
</div>
</div>
CSS
</style> <!-- Ugly Hack due to jsFiddle issue: http://goo.gl/BUfGZ -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.min.js"></script>
<style>
.ng-invalid { border: 1px solid red; }
JavaScript
function me($scope){
$scope.call = function(a){
return a.filter(function (el) {
return el.age >$26;
});
}
}