Skip to content

Instantly share code, notes, and snippets.

@joeeames
Created August 4, 2015 06:13
Show Gist options
  • Save joeeames/842da0f8d9b30dd01790 to your computer and use it in GitHub Desktop.
Save joeeames/842da0f8d9b30dd01790 to your computer and use it in GitHub Desktop.
import {Component, View, bootstrap} from 'angular2/angular2';
// import {NewItem} from 'components/new-item';
import {TodoList} from 'components/todo-list';
import {TodoItemsService} from 'services/TodoItemsService';
@Component({
selector: 'todo-app'
})
@View({
templateUrl: 'components/app.html',
directives: [TodoList]
})
export class TodoApp {
constructor() {
}
// other methods
}
bootstrap(TodoApp, [TodoItemsService]);
import {Component, View, coreDirectives, EventEmitter} from 'angular2/angular2';
import {Inject, bind} from 'angular2/di';
import {TodoItemsService} from 'services/TodoItemsService';
@Component({
selector: 'todo-list',
})
@View({
templateUrl: 'components/todo-list.html',
directives: [coreDirectives]
})
export class TodoList {
constructor(@Inject('TodoItemsService') todoItems) {
this.items = todoItems.items;
}
}
import {Injectable} from 'angular2/angular2';
@Injectable()
export class TodoItemsService {
items: array = [];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment