Tuesday, 1 September 2020

ng command to create module, component, service, model

 // Create feature module

ng g m features/AdminGroup


This causes the CLI to create a folder called admin-group with a file inside called admin-group.module.ts with the following contents:



// Create compoenent

// Create my-comp.componenet.tx inf features/api(folders will be created if note exists, my-comp will be auto @imported and declared in module), also creates my-comp folder with my-comp.component.ts

ng gc features/api/MyComp 


// Create service 

// Create my-service.service.tx inf features/service(folders will be created if note exists, my-service will be auto @imported and provided(If add @Injectable({

    providedIn: 'root',

}) in service)in module)

ng g s features/service/MyService



// Create class structure model

creates 

ng g class features/model/MyModal --type="model"



// Creates admin-api-user-profile.fakedata.model.ts file in shared/models

ng g class shared/models/admin-api-user/AdminApiUserProfile.fakedata --type="model"


No comments:

Post a Comment