Serving static html outside Angular4

前端 未结 4 1522
说谎
说谎 2020-12-16 12:37

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

1) static html files( aboutus.html, pricing.html, contact us.html etc), with corresp

相关标签:
4条回答
  • 2020-12-16 13:08

    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

    0 讨论(0)
  • 2020-12-16 13:12

    If you want to serve static files locally with ng serve, you need to add them either in your assets folder or add to the assets config. See https://github.com/angular/angular-cli/issues/5029

    0 讨论(0)
  • 2020-12-16 13:14

    You can put your static html files into the /assets/ folder.

    For example, if you put your aboutus.html file into the folder /assets/static/, then you can link to http://localhost/assets/static/aboutus.html

    0 讨论(0)
  • 2020-12-16 13:16

    In the assets key under apps, you can include any directory you like that you want angular-cli to treat as static. For example, you can declare a folder called static, and serve up static pages from there.

    For v6 applications, assets lives under browser:

    https://github.com/angular/angular-cli/blob/v6.0.0-rc.8/packages/%40angular/cli/lib/config/schema.json#L521

    0 讨论(0)
提交回复
热议问题