Angular 2路线带点

时间:2016-05-09 19:32:23

标签: typescript angular

当我导航到包含像:/ track.t这样的点的url时,我的应用程序返回带有消息的html: 不能GET /track.t

如何解决这个问题?我需要重定向到['Dashboard'];

处理路线的中央组件:

export class AppComponent {
     constructor(router:Router, location:Location, translate:TranslateService) {
            console.log(location.path());
            router.recognize(location.path())
                .then((instruction) => {
                    if (!instruction) {
                        // this code will execute if there no route exists for the current url
                        router.navigate(['Dashboard']);
                    }
                });
    }
    } 

0 个答案:

没有答案