<html ng-app>
⋮
- White
- Red
- Green
- Blue
⋮
</html>
<html ng-app>
⋮
<input type="text" ng-model="tb"/>
<div>Hallo {{tb}}</div>
⋮
</html>
<html ng-app>
⋮
<input type="text" ng-model="tb"/>
<div ng-show="tb.length">Hallo {{tb}}</div>
⋮
</html>
| constant | Konstanten |
| value | Variablen |
| service | für Singletons |
| decorator | Decorator für Services |
| factory | für Factories |
| (provider) | Die generische Methode |
<html ng-app>
⋮
<input type="text" ng-model="tb"/>
<div ng-show="tb.length">Hallo
<span ng-model="tb" contenteditable></span>
⋮
</html>
.directive('contenteditable', function () {
return {
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
elm.bind('blur', function() {
scope.$apply(function() {
ctrl.$setViewValue(elm.html());
});
});
ctrl.$render = function() {
elm.html(ctrl.$viewValue);
};
ctrl.$render();
}
};
});