Commit cbfa0c87 authored by Colin Eberhardt's avatar Colin Eberhardt Committed by Sam Saccone

Use dependency injection

parent 60c55a87
...@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) { ...@@ -10,9 +10,9 @@ var __metadata = (this && this.__metadata) || function (k, v) {
var core_1 = require('angular2/core'); var core_1 = require('angular2/core');
var store_1 = require('./services/store'); var store_1 = require('./services/store');
var TodoApp = (function () { var TodoApp = (function () {
function TodoApp() { function TodoApp(todoStore) {
this.newTodoText = ''; this.newTodoText = '';
this.todoStore = new store_1.TodoStore(); this.todoStore = todoStore;
} }
TodoApp.prototype.stopEditing = function (todo, editedTitle) { TodoApp.prototype.stopEditing = function (todo, editedTitle) {
todo.title = editedTitle; todo.title = editedTitle;
...@@ -52,7 +52,7 @@ var TodoApp = (function () { ...@@ -52,7 +52,7 @@ var TodoApp = (function () {
selector: 'todo-app', selector: 'todo-app',
templateUrl: 'app/app.html' templateUrl: 'app/app.html'
}), }),
__metadata('design:paramtypes', []) __metadata('design:paramtypes', [store_1.TodoStore])
], TodoApp); ], TodoApp);
return TodoApp; return TodoApp;
})(); })();
......
...@@ -9,8 +9,8 @@ export default class TodoApp { ...@@ -9,8 +9,8 @@ export default class TodoApp {
todoStore: TodoStore; todoStore: TodoStore;
newTodoText = ''; newTodoText = '';
constructor() { constructor(todoStore: TodoStore) {
this.todoStore = new TodoStore(); this.todoStore = todoStore;
} }
stopEditing(todo: Todo, editedTitle: string) { stopEditing(todo: Todo, editedTitle: string) {
......
var browser_1 = require('angular2/platform/browser'); var browser_1 = require('angular2/platform/browser');
var app_1 = require('./app'); var app_1 = require('./app');
browser_1.bootstrap(app_1.default); var store_1 = require('./services/store');
browser_1.bootstrap(app_1.default, [store_1.TodoStore]);
//# sourceMappingURL=bootstrap.js.map //# sourceMappingURL=bootstrap.js.map
\ No newline at end of file
import {bootstrap} from 'angular2/platform/browser'; import {bootstrap} from 'angular2/platform/browser';
import TodoApp from './app' import TodoApp from './app'
import {TodoStore} from './services/store';
bootstrap(TodoApp); bootstrap(TodoApp, [TodoStore]);
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