$ Scope Commands
$rootScope – angularjs docs
$scope.$watch – angularjs docs
$scope.$broadcast – angularjs docs
$scope.$on – angularjs docs
this vs $scope – chevtek.io
ng-repeat
The ngRepeat directive instantiates a template once per item from a collection. Each template instance gets its own scope, where the given loop variable is set to the current collection item, and $index is set to the item index or key.
Special properties are exposed on the local scope of each template instance, including:
| Variable | Type | Details |
|---|---|---|
$index |
number | iterator offset of the repeated element (0..length-1) |
$first |
boolean | true if the repeated element is first in the iterator. |
$middle |
boolean | true if the repeated element is between the first and last in the iterator. |
$last |
boolean | true if the repeated element is last in the iterator. |
$even |
boolean | true if the iterator position $index is even (otherwise false). |
$odd |
boolean | true if the iterator position $index is odd (otherwise false). |
Filters
AngularJS provides filters to transform data:
currencyFormat a number to a currency format.dateFormat a date to a specified format.filterSelect a subset of items from an array.jsonFormat an object to a JSON string.limitToLimits an array/string, into a specified number of elements/characters.lowercaseFormat a string to lower case.numberFormat a number to a string.orderByOrders an array by an expression.uppercaseFormat a string to upper case.
More topics covered:
- storing commands in Map
- ng-model for <select … >
- as keyword
- parent + child scope
- ng-repeat sortBy, filter
Links:
- Class code: parent child this
- Class code: $watch
- Class code: $broadcast $on
- Class code: ng-repeat
- Class code: ng-repeat + ajax
- Class code: calculator ex
- Lesson Summary Video!
