Lazy loading and serialization
Lazy loading and serialization
The router serializes the URL into a string that can be used in the browser's
address bar. This includes encoding special characters and handling query
parameters and fragments.
**9. Router Events**
The router emits various events during the navigation lifecycle, such as
NavigationStart, NavigationEnd, NavigationError, etc. These can be used to
track and respond to navigation changes.
**10. Example of Navigation with Parameters**
@Component({
selector: 'app-navigation',
template: `<button (click)="goToDetails(1)">Go to
Details</button>`
})
export class NavigationComponent {
constructor(private router: Router) {}
goToDetails(id: number) {
this.router.navigate(['/details', id], { queryParams: { ref:
'home' } });
}
}