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']);
};
}
回答
在我想對瀏覽超時頁面
@RouteConfig([
{path: '/landing', name: 'Landing', component: LandingComponent},
{path: '/*other', name: 'Other', redirectTo: ['Landing']}
]);
如果這解決了您的問題,請您接受答案(上/下按鈕下方的白色複選標記),以表明此問題已得到解答。謝謝。 –
我有像這樣的着陸頁...從'angular2/core'導入{Component}; @Component({ \t選擇: '登陸', \t templateUrl: '應用程序/模板/ landing.template.html' }); 出口類LandingComponent { \t } //我正在上LandingComponent找不到指令註解..你能告訴我原因 –
你再有';'在@Component的'結束(...) ;/* <<< === */export class LandingComponent {}'。裝飾者和他們正在裝飾的課堂之間不能有「;」 –
- 1. 組件「CompnentName」沒有路由配置
- 2. 自定義路由不匹配航線
- 3. VueJS路由導航不工作的動態路由組件時
- 4. Backbone.Marionette:路由器沒有正確路由
- 5. ReactJS導航特定的路線上(路由器V4)
- 6. 組件沒有路由配置。在組件中 - 角2路由錯誤
- 7. Symfony2路由器配置是否正確?
- 8. 沒有鐵路路由器的流星頁面導航
- 9. 反應路由器:位置「/」沒有匹配的路由
- 10. 確認導航與反應路由器沒有Mixin爲es6類
- 11. aurelia子路由器渲染導航父路由器設置
- 12. 沒有路線匹配[PUT]。如何正確路由?
- 13. 骨幹路由器沒有正確路由「新」路由
- 14. 沒有路由匹配指定 '路徑'
- 15. 沒有路由匹配的定製路線
- 16. 從反應路由器中未定義的組件導航?
- 17. 反應路由器導航欄導航
- 18. 導航反應路由器
- 19. 反應路由器導航
- 20. 不使用「路由器」的Durandal導航
- 21. 陣營路由器V4嵌套的路線及方案導航
- 22. 陣營路由器4 - 隱藏導航的「/」路線
- 23. Rails進行測試: 「沒有路由匹配」 定製路線
- 24. 沒有路由匹配誤差定義路線
- 25. 角4個定製路由器導航
- 26. 組件undefined沒有路由配置又名如何配置Angular 2路由器進行單元測試?
- 27. 如何匹配VUE路由器路線及組件功能
- 28. 組件路由器不NG-引導
- 29. 路由器沒有定義
- 30. 路由錯誤沒有路由匹配
末尾刪除
;
。 我已經包括在HTML 我已包括從 'angular2 /路由器' 自舉(AppComponent,[ROUTER_PROVIDERS]){進口ROUTER_PROVIDERS};在boot.ts 仍然我得到這種錯誤..請告訴我什麼是問題。 –您可以編輯您的問題並在其中添加其他信息。 –