angular - 如何从 Angular 路由中删除 URL 的重定向
问题描述
访问 mywebsite.com 时,我不希望它重定向到 mywebsite.com/home 我希望它留在 /
当我使用 Angular 路由时,我该怎么做?
我查看了 Angular Docs 并用 Google 搜索了它,但似乎找不到答案
解决方案
您可以在路由配置中添加HomeCompeont
到根路径
[{
{
path: '',
component: HomeComponent,
pathMatch: 'full'
},
{
path: 'home',
component: HomeComponent
}
.........
}]
推荐阅读
- visual-studio-code - 在 Visual Studio Code 中将具有 .C 扩展名的文件视为 C++
- node.js - 如何使用 NodeJS 执行 MongoDB shell 查询
- python - Python:UnicodeEncodeError:'latin-1'编解码器无法对位置 3-4 中的字符进行编码:序数不在范围内(256)
- performance - How can i maintain Agora.io video call memory usage
- rest - Can you get the pass or fail status of a test step with the Azure DevOps rest api?
- .net-core - Groovie Gorilla and GPIO
- c# - 从列表中添加类属性并将它们与逗号一起作为分隔符放入字符串中
- categorical-data - 传播问题
- c# - 代码覆盖率中缺少 Azure 构建项目
- node.js - 简单的无框架 Node.JS 服务器来托管 SPA React 应用程序