2016-06-13 223 views
0

我試圖設置一個組件來使用routerOnActivate掛鉤,但得到一個錯誤「該屬性routerOnActivate在組件中缺少....」,並且組件名稱「SettingsHomeComponent」在紅色下劃線這也是一個孩子的路線......Angular 2路由onActivate

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

錯字

routerOnAcivate 

應該

routerOnActivate 

(缺少t

+1

虛幻......我在那盯着的年齡...謝謝.. –