1- define ( "examples/ng-todo/1.0.0/main-debug" , [ "angularjs-debug" ] , function ( require ) {
2- var ENTER_KEY = 13 ;
1+ define ( "examples/ng-todo/1.0.0/main-debug" , [ "angularjs-debug" , "./common-debug" ] , function ( require ) {
32 var angular = require ( "angularjs-debug" ) ;
3+ var common = require ( "./common-debug" ) ;
44 var todo = angular . module ( "TodoApp" , [ ] ) ;
55 todo . service ( "todoService" , function ( ) {
66 var todos = [ ] ;
@@ -33,7 +33,15 @@ define("examples/ng-todo/1.0.0/main-debug", [ "angularjs-debug" ], function(requ
3333 }
3434 } ;
3535 } ) ;
36- var mainCtrl = todo . controller ( "MainCtrl" , [ "$scope" , "todoService" , function ( $scope , todoService ) {
36+ //TDDO Angular master code has been implemented
37+ todo . directive ( "ngBlur" , function ( ) {
38+ return function ( scope , elem , attrs ) {
39+ elem . bind ( "blur" , function ( ) {
40+ scope . $apply ( attrs . ngBlur ) ;
41+ } ) ;
42+ } ;
43+ } ) ;
44+ todo . controller ( "MainCtrl" , [ "$scope" , "todoService" , function ( $scope , todoService ) {
3745 $scope . todoService = todoService ;
3846 $scope . title = "todo" ;
3947 $scope . todos = todoService . getTodos ( ) ;
@@ -47,7 +55,7 @@ define("examples/ng-todo/1.0.0/main-debug", [ "angularjs-debug" ], function(requ
4755 this . hidden = e . target . checked ;
4856 } ;
4957 $scope . createOnEnter = function ( e ) {
50- if ( e . which !== ENTER_KEY || ! this . newTodo . trim ( ) ) {
58+ if ( e . which !== common . ENTER_KEY || ! this . newTodo . trim ( ) ) {
5159 return ;
5260 }
5361 this . todoService . addTodo ( this . newTodo ) ;
@@ -85,3 +93,11 @@ define("examples/ng-todo/1.0.0/main-debug", [ "angularjs-debug" ], function(requ
8593 } ] ) ;
8694 angular . bootstrap ( document . body , [ "TodoApp" ] ) ;
8795} ) ;
96+
97+ define ( "examples/ng-todo/1.0.0/common-debug" , [ ] , {
98+ // Which filter are we using?
99+ TodoFilter : "" ,
100+ // empty, active, completed
101+ // What is the enter key constant?
102+ ENTER_KEY : 13
103+ } ) ;
0 commit comments