angular - 如何以角度处理路由参数?
问题描述
我的应用程序在单击按钮时重定向到“localhost:4200/teams/team1”,在该按钮上我初始化了 paramValue(name) 并且也在加载正确的组件,但是当我刷新浏览器时,它无法获取路由参数值(name)它重定向到 PageNotFoundComponent。请帮我找到解决方案。
const routes: Routes = [
{path:'',component:LandingPageComponent},
{path:'teams/:name', canActivate:[AuthGuard], component: TeamComponent},
{path:'error-handler',component:ErrorHandlerComponent},
{path: '**', component:PageNotFoundComponent ,pathMatch:'full'}
];
解决方案
推荐阅读
- android - NativeScript + Angular RadDataForm 表单源初始化问题
- php - 正确形成 API 响应
- javascript - Typescript 文件在 vs2017 中自动创建 Javascript,无需 tsconfig.json 全局项目级别
- r - 获取嵌套映射函数的标准 purrr 父变量
- javascript - 从Angular中的textarea复制到剪贴板
- rust - 如何在库中实现长寿命变量/状态?
- mongodb - 在 Mac OS 上启动 MongoDB 失败
- reactjs - 无法在 ReactJS 中获取本地 IP 地址
- flutter - Flutter:异常:类型'(动态,动态,动态)=> void'不是'f'类型'(字符串,动态)=> void'的子类型
- docker - GitHub Packages Docker - 提取图像配置时出错:未知 blob