@RouteConfig([
{path: '/about', name: 'About', component: About, useAsDefault: true},
{path: '/test', name: 'Test', component: Test}
])
export class MyApp {
router: Router;
location: Location;
isCollapsed: boolean = true;
// ON ROUTE CHANGE {
this.isCollapsed = true;
// }
constructor(router: Router, location: Location) {
this.router = router;
this.location = location;
}
}
I need change variable value on every route change, how to watch for this event in Angular 2.x?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…