Using Facade Activities
export class CustomersComponent implements OnInit {
constructor(
public customers: CustomerFacade,
public router: Router,
public route: ActivatedRoute
) {
this.customers.loadAll();
}
ngOnInit(): void {
this.route.paramMap.pipe(
filter(params => params.has('id')),
map(params => params.get('id'))
).subscribe(id => this.customers.selectByKey(id));
}
select(customer: Customer): void {
this.router.navigate(['./', customer.id]);
}
}Use the Async Pipe!
Last updated