Angular Directive Important Directive
- ng-if
- ng-repeat
- ng-show
- ng-hide
- ng-click
- ng-src
- ng-model
- ng-bind
- ng-bind-html
- ng-init
NG-Repeat Aditional Parameter
- $index
- $even
- $odd
- $first
- $last
- $middle
Example:
<h1 ng-repeat="x in records"><p ng-if="$index == '1'">{{x}}</p></h1>
Angular Filter:
- {{ object | limitTo : limit : begin }}
- {{ lastName | uppercase }}
- {{ lastName | lowercase }}
- Filter is used to search element – ng-repeat=”x in cars | filter : ‘A'”
- $scope.filteredText = $filter(‘uppercase’)($scope.originalText);
- {{ orderBy_expression | orderBy : expression : reverse : comparator}} // reverse:true| false
- To Fixed two digits in float {{obj | number : 2}}
- {{ currency_expression | currency : symbol : fractionSize}} – {{ price | currency : “$” : 3}}
Example:
<span ng-click="displayFilter='all'">${All} </span> | <span ng-click="displayFilter='incident'">${Issues}</span> <div ng-repeat="item in c.data.records | unique: 'data.sys_id' | orderBy: 'data.sys_created_on' : true | filter: filterItems"> $scope.displayFilter = "all"; $scope.filterItems = function (item) { if ($scope.displayFilter=='all') { return true; } else { return item.type == $scope.displayFilter; }
No responses yet