(youtube.com/user/khanLearning)
<input ng-model="name">
<h1>{{name}}</h1>
<div ng-show="myValue"></div>
<span ng-if="checked">
This is removed when the checkbox is unchecked.
</span>
{{ filter_expression | filter : expression : comparator}}
show filter demo
{{ filter_expression | filter : expression : comparator }}
$filter('filter')(array, expression, comparator);
<li ng-repeat="item in filteredItems()">
<li ng-repeat="item in items">
<table>
<tr ng-repeat="d in data | limitTo:totalDisplayed">
<td>{{d}}</td>
</tr>
</table>
<div ng-repeat=”item in array”>
I live and die by {{item}}.
<div>
<div ng-repeat=”item in array track by item.Id”>
I live until {{array.length}} is
less than {{$index}}.
<div>
<p>One time binding {{::name}}</p>
<p>Normal binding {{name}}</p>
<div name="attr: {{::color}}">text: {{::name}}</div>
<div some-directive name="::myName" color="My color is {{::myColor}}"></div>
<ul>
<li ng-repeat="item in ::items">{{item.name}};</li>
</ul>
<input ng-model="name" ng-model-options="{ debounce: 250 }" />
$(elem).myPlugin({
onchange: function (newValue) {
// model changes outside of Angular
$(this).val(newValue);
// tell Angular values have changed and to update via $digest
$scope.$apply();
}
});
$watch(watchExpression, listener, [objectEquality]);
$watchCollection(obj, listener);
var unbinder = scope.$watch('scopeValueToBeWatcher', function(newVal, oldVal){
//do something
});
unbinder(); //this line removes the watch from $$watchers.
$scope.$watch(‘listOfBigObjects’, myHandler, true);
$scope.$watch(function($scope) {
return $scope.listOfBigObjects.
map(function(bigObject) {
return bigObject.foo.fieldICareAbout;
});
}, myHandler, true);
myApp.directive(function() {
return {
link: function(s, elem, attr) {
s.foo = scope.$eval(attr.foo);
scope.$watch(attr.list, function(list) {
// do something
}, true);
}};
});
myApp.directive(function($parse) {
return {
compile: function(elem, attr) {
var fooExp = $parse(attr.foo),
listExp = $parse(attr.list);
return function link(s, elem) {
s.foo = fooExp(s);
scope.$watchCollection(listExp, function(list) {
// do something
});
};
}
};
});
//from angular 1.3
config(['$routeProvider', '$compileProvider', function($routeProvider, $compileProvider) {
$compileProvider.debugInfoEnabled(false);
}]
(youtube.com/user/khanLearning)