Reputation: 336
I need 2 different apps on same project:
(this is required for security reasons managed by Spring Security)
I vave angular-cli.json described below:
"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"
}
}
],
But only deploy the first one (on "apps" array).
If I invert Login at position [0], this works, but mainApp Module doesn't.
Apparently the reason is, Angular Cli doesn't inject created JS files on the second html.
How can I resolve this?
Upvotes: 4
Views: 2975
Reputation: 65043
UPDATE: Multiple apps are supported now by the CLI - docs are here
Currently the Angular CLI does not support multiple apps. It is something that will be supported in the future.
For now you could work under separate directories (aka separate CLI projects).
Upvotes: 3
Reputation: 4223
You can edit your .angular-cli.json file and setup multiple apps
"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"
}
}
],
Upvotes: 0