i learning angular.js , , understand ng-model attach value (that input) controller's $scope
object. going through it's filters , not understand example given in angularjs's official site filters in angular js ,what don't understand
<label>any: <input ng-model="search.$"></label><br> <label>name <input ng-model="search.name"></label><br> <label>phone <input ng-model="search.phone"></label><br> <label>equality <input type="checkbox" ng-model="strict"></label><br> <table id="searchobjresults"> <tr> <th>name</th> <th>phone</th> </tr> <tr ng-repeat="friendobj in friends | filter:search:strict"> <td>{{friendobj.name}}</td> <td>{{friendobj.phone}}</td>
in above code how add parameters ng-model , how being accessed ? because ng-init has "friends" , how theses 2 being related perform filter or search ?
trying understand how providing search.name or search.phone able access friends.name , friends.phone respectively
friends
object array. each sub object of friends
has name
, phone
properties. object array filled ng-init said.
also have search
object (model) in scope. has name
, phone
properties, too.
friendobj in friends | filter:search:strict
standard usage filter directive. means that; filter "friends" using "search".
when filter friends
(object array) using search
object angularjs iterates on friends
, collects records returns true both friendobj.name == search.name
, friendobj.phone == search.phone
(in strict mode). if set last (strict) parameter false, checks substrings.
Comments
Post a Comment