Commit 348b849d authored by Pascal Hartig's avatar Pascal Hartig

angularjs_require: replace todo-blur with ng-blur

parent a0a139c2
......@@ -35,7 +35,7 @@
<button class="destroy" ng-click="removeTodo(todo)"></button>
</div>
<form ng-submit="doneEditing(todo)">
<input class="edit" ng-trim="false" ng-model="todo.title" todo-blur="doneEditing(todo)" todo-focus="todo == editedTodo">
<input class="edit" ng-trim="false" ng-model="todo.title" ng-blur="doneEditing(todo)" todo-focus="todo == editedTodo">
</form>
</li>
</ul>
......
/*global define*/
'use strict';
/**
* Directive that executes an expression when the element it is applied to loses focus.
*/
define(['app'], function (app) {
app.directive('todoBlur', function () {
return function (scope, elem, attrs) {
elem.bind('blur', function () {
scope.$apply(attrs.todoBlur);
});
};
});
});
......@@ -12,6 +12,6 @@ require.config({
}
});
require(['angular', 'app', 'controllers/todo', 'directives/todoFocus', 'directives/todoBlur'], function (angular) {
require(['angular', 'app', 'controllers/todo', 'directives/todoFocus'], function (angular) {
angular.bootstrap(document, ['todomvc']);
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment