I am using Angular CLI to support multiple applications within one project.
"apps": [
{
"name": "app1",
"root": "src/app1",
"outDir": "dist/app1",
.
.
},
{
"name": "app2",
"root": "src/app2",
"outDir": "dist/app2",
.
.
}
]
But when I am running following command to generate a service
C:\POC\test1\src\app1\app>ng g service test --app=app1
Service is generated like this
create src/app1/src/app1/app/test.service.spec.ts (362 bytes)
create src/app1/src/app1/app/test.service.ts (110 bytes)
This is not correct. It should create like
create src/app1/app/test.service.spec.ts (362 bytes)
create src/app1/app/test.service.ts (110 bytes)
Am I doing something wrong?
I would say you found a bug. Tested your setting on Angular CLI v.1.2.0 and v.1.3.2 both working fine, but at v.1.4.2 and latest v.1.4.3 I get the same behaviour.
Since the Angular CLI release notes of 1.4.x don't spot any significant changes I guess the behaviour is not intended. Maybe downgrade for a while or open a bug report.
EDIT: The problem was that Angular CLI hardcodes appRoot to app
which causes the error. This was fixed with PR 7775 .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.