首页 > 解决方案 > 以角度4处理多个html文件

问题描述

我想在 Angular4 中调用不同的 html 文件。
在我的项目中,我创建了目录 abc。目录结构如下:

 abc-->app  
       src
       Index.html
       abc.html
       *.css files
       *.js files
       *.json files
       *.ts files

我想调用abc.htmlpage insted of index.html
怎么能做到这一点?

在Angular 4中可以吗?
如果是,比怎么样?
请建议我,如果可能的话,请提供一个例子。

标签: angular

解决方案


在您的 angular-cli.json 中:

  "apps": [
    {
      "root": "src",
      "outDir": "dist",
      "assets": [
        "assets",
        "favicon.ico"
      ],
      "index": "abc.html", <----- Here you can specify the name
      "main": "main.ts",
      "polyfills": "polyfills.ts",
      "test": "test.ts",
      "tsconfig": "tsconfig.app.json",
      "testTsconfig": "tsconfig.spec.json",
      "prefix": "app",
      "styles": [
        "styles.css"
      ],
      "scripts": [],
      "environmentSource": "environments/environment.ts",
      "environments": {
        "dev": "environments/environment.ts",
        "prod": "environments/environment.prod.ts"
      }
    }
  ]

推荐阅读