I\'m starting to use angular-cli and I\'ve already read a lot to find an answer about what I want to do...no success, so I came here.
Is there a way to create a componen
A common pattern is to create a feature with a route, a lazy loaded module, and a component.
Route: myapp.com/feature
app-routing.module.ts
{ path: 'feature', loadChildren: () => import('./my-feature/my-feature.module').then(m => m.MyFeatureModule) },
File structure:
app
└───my-feature
│ │ my-feature-routing.module.ts
│ │ my-feature.component.html
│ │ my-feature.component.css
│ │ my-feature.component.spec.ts
│ │ my-feature.component.ts
│ │ my-feature.module.ts
This can all be done in the cli with:
ng generate module my-feature --module app.module --route feature
Or shorter
ng g m my-feature --module app.module --route feature
Or if you leave out the name the cli will prompt you for it. Very useful when you need to create several features
ng g m --module app.module --route feature