Last active
September 11, 2017 16:02
-
-
Save nitayneeman/3f9e6559b2cb0006a45da5d310ec1bf4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
selector: 'my-app', | |
templateUrl: './app.component.html' | |
}) | |
export class AppComponent { | |
public todos: string[]; | |
constructor(private appService: AppService) { | |
this.todos = ['Todo', 'Todo', 'Todo']; | |
} | |
addTodo(): void { | |
this.appService | |
.fetchData() | |
.subscribe((todo: string) => this.todos.push(todo)); | |
} | |
removeTodo(index: number): void { | |
this.todos.splice(index, 1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment