gpt4 book ai didi

angular - 自定义 404 页面 Ionic 3

转载 作者:太空狗 更新时间:2023-10-29 17:56:47 26 4
gpt4 key购买 nike

我正在尝试从用户写下的未知路径重定向到自定义 404 页面:

例如:

/login 进入登录页面

/main 转到主页面

{unknown-path} 转到 404

    export const deepLinkConfig: DeepLinkConfig = {
links: [
{ component: HomePage, name: "Home", segment: "" },
{ component: LoginPage, name: "Login", segment: "login", defaultHistory: [HomePage] },
{ component: SubscribePage, name: "Signup", segment: "signup", defaultHistory: [HomePage] },
{ component: SubscribeExtendPage, name: "Signup", segment: "signup-extend", defaultHistory: [HomePage] },
{ component: MainPage, name: "Main", segment: "main", defaultHistory: [HomePage] },
{ component: WelcomePage, name: "Welcome", segment: "welcome" },
{ component: NotFoundPage, name: "notFound", segment: "login/**", defaultHistory: [NotFoundPage] },
]
};


imports: [
BrowserModule,
HttpClientModule,
MaterializeModule,
BrowserAnimationsModule,
IonicModule.forRoot(MyApp, {}, deepLinkConfig)
],

感谢您的帮助。

最佳答案

{ component: NotFoundPage, name: "*", segment: ":**", defaultHistory: [NotFoundPage] },

我不知道这是否是最好的解决方案,但最终使用任何类型的变量设置段,:** 现在所有未知的 url 都被重定向到 NotFoundPage。

关于angular - 自定义 404 页面 Ionic 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47770024/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com