这是我目前使用旧库的尝试。
我现在正在使用最新的库,我该如何更新:
import { Component, } from '@angular/core';
import { Location } from '@angular/common';
import { Router } from '@angular/router';
@Component({
moduleId: module.id,
selector: 'HeaderComponent',
templateUrl: 'header.component.html'
})
export class HeaderComponent{
router : Router;
constructor(router: Router, location: Location){
this.router = router;
this.router.changes.subscribe((currentRoute) => {
let currentRoute = this.location.path();
})
}
}
这是我的模块:
export * from './header.component';
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { HeaderComponent } from './header.component';
@NgModule({
imports: [RouterModule, CommonModule],
declarations: [HeaderComponent],
exports: [HeaderComponent],
providers: []
})
export class HeaderModule { }