Error: Uncaught (in promise): Error: Cannot match any routes: 'about'
Error: Uncaught (in promise): Error: Cannot match any routes: 'about'
我是 Angular2 + Nativescript + TypeScript 的新手,我正在尝试重现我的 cordova 应用程序。我试图从登录页面导航到关于页面,但出现此错误:
Error: Uncaught (in promise): Error: Cannot match any routes: 'about'
在我的 app.routes.ts
文件中,我有以下代码:
import { Routes } from "@angular/router";
export const appRoutes: Routes = [
{
path: "",
redirectTo: "/login",
pathMatch: "full"
},
{
path: "about",
redirectTo: "/about",
pathMatch: "full"
}
];
然后,在我的 login.component.ts 中,我尝试使用路由器实例导航到关于页面:
this.router.navigate(["/about"]);
然后我收到错误消息。我错过了什么吗?
谢谢!
{
path : "about",
redirectTo : "/about",
pathMatch : "full"
}
改为或添加,
{
path : "about",
component : AboutComponent //<====whatever component you have. Maybe the relevant component is not found
}
我是 Angular2 + Nativescript + TypeScript 的新手,我正在尝试重现我的 cordova 应用程序。我试图从登录页面导航到关于页面,但出现此错误:
Error: Uncaught (in promise): Error: Cannot match any routes: 'about'
在我的 app.routes.ts
文件中,我有以下代码:
import { Routes } from "@angular/router";
export const appRoutes: Routes = [
{
path: "",
redirectTo: "/login",
pathMatch: "full"
},
{
path: "about",
redirectTo: "/about",
pathMatch: "full"
}
];
然后,在我的 login.component.ts 中,我尝试使用路由器实例导航到关于页面:
this.router.navigate(["/about"]);
然后我收到错误消息。我错过了什么吗?
谢谢!
{
path : "about",
redirectTo : "/about",
pathMatch : "full"
}
改为或添加,
{
path : "about",
component : AboutComponent //<====whatever component you have. Maybe the relevant component is not found
}