I am curious about whether it is possible to set the active route from a script instead of just from the HTML template. Let me provide an example:
@Component({
template: `<input type="button" (click)="back()" value="back" />`
})
export class MyComponent implements OnInit {
constructor(private someService: SomeService) {}
ngOnInit(): void {
this.someService.someObservable$.pipe(first()).subscribe(_ => this.back());
}
back(): void {
// do stuff before navigating back ...
// navigate to dashboard
}
}
Any insights are appreciated!