AngularJS : ng-repeat filter when value is greater than

Create a predicate function on the relevant scope: $scope.greaterThan = function(prop, val){ return function(item){ return item[prop] > val; } } As a first argument, it takes a property name on the object. The second argument is an integer value. Use it in your view like this: <tr ng-repeat-start=”list in Data.Items | filter: greaterThan(‘NumberOfStamps’, 0)”> Demo

In the AngularJS BootstrapUI Typeahead, what’s $viewValue?

here is a working typeahead example: <div class=”container”> <div ng-controller=”mainCtrl” class=”row-fluid”> <form class=”row-fluid”> <div class=”container-fluid”> <input type=”text” ng-model=”selected” typeahead=”state for state in states | filter:$viewValue” /> </div> </form> </div> </div> <script> angular.module(‘myApp’, [‘ui.bootstrap’]) .controller(“mainCtrl”, function ($scope) { $scope.selected = ”; $scope.states = [‘Alabama’, ‘Alaska’, ‘Arizona’, ‘Arkansas’, ‘California’, ‘Colorado’, ‘Connecticut’, ‘Delaware’, ‘Florida’, ‘Georgia’, ‘Hawaii’, ‘Idaho’, ‘Illinois’, …

Read more

Orderby not working with dict syntax on ng-repeat

The parameters to orderBy must match property names in an array of objects. Your data needs to look something like this: $scope.list2 = [ { id:”2013-01-08T00:00:00″, name:’Joe’}, { id:”2013-01-09T00:00:00″, name:’Sue’}]; Then a filter like this will work: <div ng-repeat=”item in list2 | orderBy:’id’:true”> Fiddle. Note that orderBy works on the entire array (something in your …

Read more

Custom child directive accessing scope of parent

The city directive $parent is a transcluded scope of state directive. The transcluded scope of the state directive is inherit for $parent of state directive which is controller thus that is why $parent.MyName = India. The $parent of transcluded scope is the state directive isolated scope ( scope = {} ) that is why $parent.$parent.MyName …

Read more