todo-list.component.ts
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
export class TodoListComponent implements OnInit { | |
public selectedTodo$ = this.todoListSandboxService.selectedTodo$; | |
public todoList: TodoItem[]; | |
public isLoading = false; | |
constructor(private todoListSandboxService: TodoListSandboxService) {} | |
public ngOnInit(): void { | |
// mapping to state property - don't do this! | |
this.todoListSandboxService.todoList$.subscribe(todoList => { | |
this.todoList = todoList; | |
}); | |
this.todoListSandboxService.isLoading$.subscribe(isLoading => { | |
this.isLoading = isLoading; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment