Skip to content

Instantly share code, notes, and snippets.

@lydemann
Created December 24, 2019 13:43
Embed
What would you like to do?
todo-list.component.ts
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