-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
48 lines (48 loc) · 2.07 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/// <reference path="typings/angular2/angular2.d.ts" />
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") return Reflect.decorate(decorators, target, key, desc);
switch (arguments.length) {
case 2: return decorators.reduceRight(function(o, d) { return (d && d(o)) || o; }, target);
case 3: return decorators.reduceRight(function(o, d) { return (d && d(target, key)), void 0; }, void 0);
case 4: return decorators.reduceRight(function(o, d) { return (d && d(target, key, o)) || o; }, desc);
}
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
var angular2_1 = require('angular2/angular2');
var todoService_1 = require('todoService');
var TodoApp = (function () {
function TodoApp(todoService) {
this.todoService = todoService;
this.title = 'My TODO app';
}
TodoApp.prototype.keyup = function (newTodo, $event) {
if ($event.which === 13) {
this.addTodo(newTodo);
}
};
TodoApp.prototype.addTodo = function (newTodo) {
this.todoService.addTodo(newTodo.value);
newTodo.value = '';
newTodo.focus();
};
TodoApp = __decorate([
angular2_1.Component({
selector: 'todo-app',
services: [todoService_1.TodoService]
}),
angular2_1.View({
templateUrl: 'todo.html',
directives: [angular2_1.CORE_DIRECTIVES]
}),
__param(0, angular2_1.Inject('TodoService')),
__metadata('design:paramtypes', [todoService_1.TodoService])
], TodoApp);
return TodoApp;
})();
exports.TodoApp = TodoApp;
angular2_1.bootstrap(TodoApp, [todoService_1.TodoService, angular2_1.bind('TodoService').toClass(todoService_1.TodoService)]);