filmov
tv
Angular cli generate module
Показать описание
In this video we will discuss generating modules using the Angular CLI.
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
To generate a module use
ng generate module moduleName or ng g m moduleName
For example. to generate a students module we could use
ng generate module students -d or ng g m students -d
Please note : Since we are using the --dry-run flag, the module file and folder is not actually created. We only get the report of the files and folders that will be created.
The above command generates the students module inside students folder. Remember for us to be able to use this newly generated module, we must import it in the root module.
We can do it manually after creating the module or we can tell Angular CLI to import our newly generated module into the root module using --module option. We can also use it's alias -m
The following command not only generates students module, it also imports it into the root module (AppModule)
By default a spec file is not generated. If you also want a spec file to be generated use the --spec option
When generating a module, Angular CLI by default creates a folder for the module and places the module files in that folder. If you do not want a dedicated folder for the module you are generating, use --flat option.
Unitil now, we have been using the --dry-run option. Now let's remove the -d option and execute the command so the module is actually created.
1. The required import statement to import students module is included
2. The students module is also included in the "imports" array
Text version of the video
Slides
Angular CLI Tutorial
Angular CLI Text articles & Slides
All Dot Net and SQL Server Tutorials in English
All Dot Net and SQL Server Tutorials in Arabic
Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
To generate a module use
ng generate module moduleName or ng g m moduleName
For example. to generate a students module we could use
ng generate module students -d or ng g m students -d
Please note : Since we are using the --dry-run flag, the module file and folder is not actually created. We only get the report of the files and folders that will be created.
The above command generates the students module inside students folder. Remember for us to be able to use this newly generated module, we must import it in the root module.
We can do it manually after creating the module or we can tell Angular CLI to import our newly generated module into the root module using --module option. We can also use it's alias -m
The following command not only generates students module, it also imports it into the root module (AppModule)
By default a spec file is not generated. If you also want a spec file to be generated use the --spec option
When generating a module, Angular CLI by default creates a folder for the module and places the module files in that folder. If you do not want a dedicated folder for the module you are generating, use --flat option.
Unitil now, we have been using the --dry-run option. Now let's remove the -d option and execute the command so the module is actually created.
1. The required import statement to import students module is included
2. The students module is also included in the "imports" array
Text version of the video
Slides
Angular CLI Tutorial
Angular CLI Text articles & Slides
All Dot Net and SQL Server Tutorials in English
All Dot Net and SQL Server Tutorials in Arabic
Комментарии