angular - url中的查询参数不适用于角度
问题描述
当我在 URL 中使用查询参数时,出现以下错误:
ERROR 错误:未捕获(在承诺中):错误:无法匹配任何路由。URL 段:'home/instagram/overview%3Fcode%3D7a6e5944cae649248dfad5509d8e6e67' 错误:无法匹配任何路由。URL 段:'home/instagram/overview%3Fcode%3D7a6e5944cae649248dfad5509d8e6e67' 在 ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError (router.js:2469) 在 CatchSubscriber.selector (router .js:2450)
这是我的路由:
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {InstagramComponent} from './instagram.component';
import {InstagramAnalysisComponent} from './instagram-analysis /instagram-analysis.component';
const instagramRoutes: Routes = [
{
path: '', component: InstagramComponent,
children: [
{path: 'overview', loadChildren: './instagram-overview/io.module#IoModule'},
{path: 'content-production', loadChildren: './instagram-content/instagram-content-production/icp.module#IcpModule'},
{path: 'all-content', loadChildren: './instagram-content/instagram-all-content/iac.module#IacModule'},
{path: 'analyz', component: InstagramAnalysisComponent},
{path: 'create/addig', loadChildren: './add-instagram/add-ig.module#AddIgModule'},
]
}
];
@NgModule({
imports: [
RouterModule.forChild(instagramRoutes)
],
exports: [
RouterModule
]
})
export class InstagramRoutingModule {
}
我希望下面的 URL 可以正常工作,但这不起作用: http://localhost:4200/home/instagram/create/addig?code=7a6e5944cae649248dfad5509d8e6e67
我必须在路由中做些什么来解决这个问题?
解决方案
推荐阅读
- google-cloud-platform - 如何使用 firewalls.list 方法按 sourceRanges 0.0.0.0/0 过滤防火墙规则列表
- reactjs - 格子 api 脚本在下一个 js 应用程序中全局化
- bash - 我可以在 UNIX 的 awk 中使用 awk 吗?
- amazon-web-services - AWS kinesis 视频流 (KVS) 多点
- python - 与数据框中的前一行相比,如何识别行中的字符串更改?
- php - php - 获取当前变量名并将其作为数组键
- c++ - 当原始字符串和反向字符串相同时,为什么第一种和第二种情况一直返回 false?回文码
- php - mysql 之类的查询,如何对表中的两列进行排序,但按一列匹配的结果排序
- react-native - 在 react native 中使用 FlatList 时如何滚动?
- tensorflow-lite - NMS 在 tensorflow-lite 量化模型中不起作用