Angular “组件”;AppComponent";没有路由配置,路由器未定义导航
删除Angular “组件”;AppComponent";没有路由配置,路由器未定义导航,angular,Angular,删除在 import { Component } from 'angular2/core'; import { Router } from 'angular2/router'; import { RouteConfig } from 'angular2/router'; import { ROUTER_DIRECTIVES } from 'angular2/router'; import { LandingComponent } from './landing.compo
代码>在
import { Component } from 'angular2/core';
import { Router } from 'angular2/router';
import { RouteConfig } from 'angular2/router';
import { ROUTER_DIRECTIVES } from 'angular2/router';
import { LandingComponent } from './landing.component';
@RouteConfig([
{path: '/landing', name: 'Landing', component: LandingComponent},
{path: '/*other', name: 'Other', redirectTo: ['Landing']}
]);
@Component({
selector: 'cwf',
templateUrl: 'app/template/index.template.html',
directives: [ROUTER_DIRECTIVES]
})
export class AppComponent {
constructor(private _router:Router){
}
browserObject = BrowserDetect;
navigator = navigator.javaEnabled() ? "enabled" : "disabled";
listBrowser = BrowserDetect.supportedBrowser;
ngOnInit(){
let timer = Observable.timer(2000);
timer.subscribe(this.navigate);
};
navigate = () => {
this._router.navigate(['Landing']);
};
}
我想在超时时浏览页面。我已经在HTML中包括了从'angular2/ROUTER'引导(AppComponent,[ROUTER_PROVIDERS])导入{ROUTER_PROVIDERS};在boot.ts中,我仍然会遇到这种错误。。请告诉我问题出在哪里。您可以编辑您的问题并在那里添加其他信息。如果这解决了您的问题,请您接受答案(上/下投票按钮下方的白色复选标记)以指示此问题已得到回答。谢谢。我有这样的登陆页面。。。从'angular2/core'导入{Component}@组件({selector:'landing',templateUrl:'app/template/landing.template.html'});导出类LandingComponent{}//我在LandingComponent上找不到任何指令批注。。你能告诉我你又有一个的原因吗代码>在@组件(…)的末尾/*
@RouteConfig([
{path: '/landing', name: 'Landing', component: LandingComponent},
{path: '/*other', name: 'Other', redirectTo: ['Landing']}
]);