我在同一个项目中需要2个不同的应用程序:
(由于Spring Security管理的安全原因,这是必需的)
我vave angular-cli.json如下所述:
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"test": "test.ts",
"tsconfig": "tsconfig.json",
"prefix": "app",
"mobile": false,
"styles": [
"styles.scss"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
},
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "login.html",
"main": "login.ts",
"test": "login-test.ts",
"tsconfig": "login-tsconfig.json",
"prefix": "login-app",
"mobile": false,
"styles": [
"login-styles.scss"
],
"scripts": [],
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
但只部署第一个(在“apps”数组上)。
如果我在位置[0]反转Login,则可以,但是mainApp模块没有。
显然原因是,Angular Cli没有在第二个html上注入创建的JS文件。
我该如何解决这个问题?
答案 0 :(得分:3)
答案 1 :(得分:0)
您可以编辑.angular-cli.json文件并设置多个应用
"apps": [
{
"root": "src",
"outDir": "../Application.Web.UI/wwwroot/app/Candidate",
"assets": [
"assets"
],
"index": "index.html",
"main": "main.candidate.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app_andidate",
"styles": [ "share/css/material.scss" ],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
},
{
"root": "src",
"outDir": "../Application.Web.UI/wwwroot/app/Company",
"assets": [
"assets"
],
"index": "index.html",
"main": "main.company.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app_company",
"styles": [ "share/css/material.scss" ],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],