Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
100
rated 0 times [  105] [ 5]  / answers: 1 / hits: 132098  / 6 Years ago, fri, october 26, 2018, 12:00:00

While learning up Angular I just went through the various Angular-CLI commands to generate individual parts of Angular like 'Component', 'Services', 'Interface', 'Pipes', etc.



Generating Angular Items via Angular-CLI



ng g c components/comp-1 //generates component
ng g s services/service-1 // generates service
ng g i interfaces/interface-1 // generates interface


But, I am amazed why there is no generate command for 'Model' (though Interface also does nearly some work -- but model is more powerful as can contain methods also in Class).



Am I missing something or Team-Angular missed on generating a command for 'automatically generating Models' -- as they are at the very core of OOPS Framework.



enter



Reference:



https://www.npmjs.com/package/angular-cli


More From » angular

 Answers
11

Because a model is a class, to generate it use --type option like this:



ng generate class hero --type=model


will result in:



hero.model.ts

[#53243] Tuesday, October 23, 2018, 6 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
noel

Total Points: 49
Total Questions: 90
Total Answers: 104

Location: Aland Islands
Member since Wed, Nov 17, 2021
3 Years ago
noel questions
;