Suggested Videos
Part 10 - Angular cli generate service | Text | Slides
Part 11 - Angular cli generate module | Text | Slides
Part 12 - Angular cli generate directives, pipes and routing guards | Text | Slides
So far we have discussed generating angular features like components, services, directives etc. We can use the Angular CLI to generate TypeScript features as well. In this video we will discuss generating TypeScript features like classes, interfaces and enumerations using the Angular CLI.
As you have seen throughout this course, Angular CLI provides consistent set of commands for generating features.
To generate a class use
ng generate class className or ng g cl className
For example, to generate an employee class use
ng g cl employee
The above command places the employee class directly in the "app" folder. Instead if you want the employee class in a different folder, simply prefix the name of the folder. The command below creates a folder with name "employee" and then creates the "employee" class in it.
ng g cl employee/employee
By default, a spec file is not created for the class. If you want a spec file to be generated set --spec option to true.
ng g cl employee/employee --spec=true
To generate an interface use
ng generate interface interfaceName or ng g i interfaceName
To generate an enum use
ng generate enum enumName or ng g e enumName
Part 10 - Angular cli generate service | Text | Slides
Part 11 - Angular cli generate module | Text | Slides
Part 12 - Angular cli generate directives, pipes and routing guards | Text | Slides
So far we have discussed generating angular features like components, services, directives etc. We can use the Angular CLI to generate TypeScript features as well. In this video we will discuss generating TypeScript features like classes, interfaces and enumerations using the Angular CLI.
As you have seen throughout this course, Angular CLI provides consistent set of commands for generating features.
To generate a class use
ng generate class className or ng g cl className
For example, to generate an employee class use
ng g cl employee
The above command places the employee class directly in the "app" folder. Instead if you want the employee class in a different folder, simply prefix the name of the folder. The command below creates a folder with name "employee" and then creates the "employee" class in it.
ng g cl employee/employee
By default, a spec file is not created for the class. If you want a spec file to be generated set --spec option to true.
ng g cl employee/employee --spec=true
To generate an interface use
ng generate interface interfaceName or ng g i interfaceName
To generate an enum use
ng generate enum enumName or ng g e enumName
Hi Sir,
ReplyDeleteI tried --flate comment to create Specifies folder, but its not working for TypeScript futures,
--flat=false
ReplyDelete