Angular 2路由onActivate

时间:2016-06-13 17:43:23

标签: angular typescript1.8

我试图设置一个组件来使用routerOnActivate挂钩,但是收到错误"组件中缺少属性routerOnActivate ....'和组件名称' SettingsHomeComponent'用红色下划线。这也是一条儿童路线...



import {Component} from '@angular/core';
import {Routes, RouteSegment, RouteTree, ROUTER_DIRECTIVES, OnActivate} from '@angular/router';
import {SettingsProfileComponent} from '../profile/settings.profile.component';

@Component({
    selector: 'kg-Settings ',
    templateUrl: './app/components/settings/home/settings.home.component.html',
    directives: [ROUTER_DIRECTIVES]
})

export class SettingsHomeComponent implements OnActivate{
 public isSettingsHome: boolean = false;
  
  routerOnAcivate(curr: RouteSegment, prev?: RouteSegment, currTree?: RouteTree, prevTree?: RouteTree) :void {
       
   }
}




任何人都可以看到错误或告诉我这里有什么问题......

提前致谢。

1 个答案:

答案 0 :(得分:1)

错字

routerOnAcivate

应该是

routerOnActivate

(缺少t