After generating modules:
$ ng generate module myTestModule
installing module
create src/app/my-test-module/my-test-module.module.ts
$ ng generate module myTestModule2
installing module
create src/app/my-test-module2/my-test-module2.module.ts
I have the main module file called app.module.ts
. How can I register my-test-module.module.ts
in the app.module.ts
and my-test-module2.module.ts
in the my-test-module.module.ts
?
More details for better understanding
$ ng generate --help
module <name> <options...>
aliases: m
--spec (Boolean) Specifies if a spec file is generated.
--flat (Boolean) Flag to indicate if a dir is created.
--routing (Boolean) (Default: false) Specifies if a routing module file should be generated.
--app (String) Specifies app name to use.
aliases: -a <value>
No mention of -m
or --module
as described on this wiki
My current angular cli version:
$ ng -v
@angular/cli: 1.0.1
node: 7.4.0
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.0.1
@angular/compiler-cli: 4.1.3
Additional information
I have updated my angular-cli
to v1.2.1. Now I can use an alias -m
module <name> <options...>
aliases: m
--spec (Boolean) Specifies if a spec file is generated.
--flat (Boolean) Flag to indicate if a dir is created.
--routing (Boolean) (Default: false) Specifies if a routing module file should be generated.
--app (String) Specifies app name to use.
aliases: -a <value>
--module (String) Specifies where the module should be imported.
aliases: -m <value>
So, I attempted:
$ ng g m MyTestModuleModule34 -m AppModule
installing module
Specified module does not exist
Even though the specified module exists in src/app/app-module.ts