简体   繁体   English

如何为多页应用程序设置角度路由?

[英]how to setup angular routing for multi page application?

I am creating a web application (multi page) using angular 6 and want to setup routes module for different views.我正在使用 angular 6 创建一个 Web 应用程序(多页),并希望为不同的视图设置路由模块。 So far i could see examples which shows components are rendered in the same page (index page) using router-outlet element and routerLink attribute in a tag.到目前为止,我可以看到一些示例,这些示例使用标签中的 router-outlet 元素和 routerLink 属性在同一页面(索引页面)中呈现组件。

In multi page application how to set up the routes which can redirect to different page and load the angular components ?在多页面应用程序中如何设置可以重定向到不同页面并加载角度组件的路由?

As mentioned in the comments, Angular is a Single Page Application Framework.正如评论中提到的,Angular 是一个单页应用程序框架。 There is ne need to have another page like contact.html.需要有另一个页面,如contact.html。 You generate a component called contacs or so and in your router you simply reference the component with the path youd like, for example "/contacts".您生成一个名为 contacs 左右的组件,在您的路由器中,您只需使用您喜欢的路径引用该组件,例如“/contacts”。 I've done a quick research and found that there should be no need to have multiple static html files in angular.我做了一个快速的研究,发现应该没有必要在 angular 中有多个静态 html 文件。 Maybe you should reconsider your Framework choice and use a Framework which is meant to be used with multiple html files!也许您应该重新考虑您的框架选择并使用一个旨在与多个 html 文件一起使用的框架! Good Luck祝你好运

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM