Skip to content

Commit 04c47fc

Browse files
committed
U: update ng-todo example
1 parent 04b4016 commit 04c47fc

File tree

19 files changed

+31453
-1719
lines changed

19 files changed

+31453
-1719
lines changed

app/ng-todo.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ <h1>{{title}}</h1>
5858
base: "../sea-modules/",
5959
alias: {
6060
"$": "jquery/jquery/1.10.1/jquery.js",
61-
"angularjs": "angular/angularjs/1.0.7/angular.js"
61+
"angularjs": "gallery/angularjs/1.1.5/angular.js"
6262
}
6363
});
6464

sea-modules/examples/ng-todo/1.0.0/main-debug.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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+
});

sea-modules/examples/ng-todo/1.0.0/main.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)