【发布时间】:2015-12-23 22:40:32
【问题描述】:
@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;
}
}
我需要在每次路由更改时更改变量值,如何在 Angular 2.x 中监视此事件?
【问题讨论】:
-
对于新路由器 (=> RC.3),请参阅 stackoverflow.com/questions/37137455/…
标签: typescript angular