AngularJS
Filters, More Directives
AngularJS Filters, More Directives Directives so far ng-app: - - - PowerPoint PPT Presentation
AngularJS Filters, More Directives Directives so far ng-app: - attach the application module to the page. ng-controller: - attach a controller function to the page. ng-show / ng-hide: - display a section based on an Expression.
Filters, More Directives
page.
page.
Expression.
Array.
the user
a pipe character
templates using the following recipe: {{ data* | filter:options* }}
{{12 | currency}} // à $12.00
{{ 'some date' | date: 'MM/dd/yyyy @ h:mma' }}
{{ 'octagon gem' | uppercase }}
characters in a string to display {{ 'My Description' | limitTo:8}}
array to display (e.g. the first 3 items) <li ng-repeat="product in products | limitTo:3">
(e.g., most expensive to least expensive) <li ng-repeat="product in products |
src attribute doesn't work right:
until Angular replaces the expression inside {{hash}} <img src="{{product.image}}"/> // don’t do this
<img ng-src="{{product.image}}"/> // DO THIS
{{ expression | filter1 | filter2 | ... }}
{{ ‘This is an expression’| uppercase| limitTo:14}}
product object.
ng-src: <ul class="img-thumbnail clearfix"> <li ng-repeat=‘image in product.images’> <img ng-src="{{image}}" /> </li> </ul>