在 Angular4 之外提供静态 html [英] Serving static html outside Angular4

查看:33
本文介绍了在 Angular4 之外提供静态 html的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Angular 4/Angular 2 的初学者.我正在构建一个包含

I am a beginner in Angular 4/ Angular 2. I am building an app which consists of

1) 静态 html 文件(aboutus.html、pricing.html、contact us.html 等),以及相应的 css、js 文件2) 功能复杂的单页应用

1) static html files( aboutus.html, pricing.html, contact us.html etc), with corresponding css, js files 2) single page application with complex functionality

第一部分 #1 根本不需要 Angular,因为它是完全静态的.登录后,用户来到#2.从我经历的 Angular 教程来看,似乎我需要将 #1 和 #2 结合在一起,并且仍然必须从 #1 中创建组件等,我觉得这是不必要的.

The first part #1 does not need Angular at all as it's completely static. After login a user comes to #2. From the Angular tutorials that I went through, it seems I need to combine #1 and #2 together and still have to create components etc out of #1, which I feel is unnecessary.

有没有办法,我可以构建这个项目,这样我就可以按原样使用静态 html,并且仅将 Angular 用于动态单页应用程序?任何有用的链接或示例将不胜感激.

Is there a way, I can build this project such that I can use the static html as is and use Angular only for the dynamic single page app? Any helpful links or examples would be much appreciated.

推荐答案

您不能使用路由器来集成静态 html 页面,但您仍然可以使用普通的 HTML 链接.无需命名包含 Angular 应用程序 index.html 的文件

You can't use the router to integrate static html pages, but you still can use normal HTML links. There is no need to name the file that contains the Angular application index.html

这篇关于在 Angular4 之外提供静态 html的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆