Questions tagged [ng-generate]
5 questions
51
votes
4 answers
ng generate component in subdirectory
I have the following directory structure
I would like to create a new page, let's say, an About page.
I want to put it in src/app/page/about/*
So I try:
ng generate component pages/about
but I get this error:
Error: More than one module matches.…

Alexander Mills
- 90,741
- 139
- 482
- 817
1
vote
3 answers
Angular 9: how can I create a .ts file alone?
I'm new to Angular and now I want to create only a .ts file and not a whole component, can you please tell me how can I do it with ng generate?
Use-Case :
While building the application I want to write the build version to a .ts.I want to load this…

snow white
- 61
- 1
- 2
- 6
0
votes
1 answer
Angular 15 - ng generate environments
How can I resolve the error "Error: A collection and schematic is required during execution" that I encountered while attempting to generate environments automatically using the ng generate environments command in Angular (version 15.0.5)?
The…

JustQuest
- 249
- 4
- 15
0
votes
3 answers
When generating an angular component where does the src/app prefix come from
I'm probably bad at google for not finding this but here it goes.
When generating a component with ng generate where does the src/app path prefix come from and how can I change it?
I'm talking about src/app in the following image.

gyozo kudor
- 6,284
- 10
- 53
- 80
0
votes
2 answers
ng generate component fails in one module only - Cannot read property '0' of null
Trying to generate a new component in one of my modules.
I navigate to [project]/src/app and enter
ng g c admin/list where admin is the existing module and list is the name of the new component I want to generate.
Result:
Cannot read property '0' of…

Chris Curnow
- 643
- 5
- 15