As explain in various places in angularjs (v2.0.0-rc.4) guide (e.g https://angular.io/styleguide#!#04-06)
class are named "hero.model.ts"
running ng generate class hero
generate a hero.ts and a hero.spec.ts
You can either:
ng generate model <model-type>OS: Microsoft Windows [version 6.1.7601]
Versions:
ng --version
angular-cli: 1.0.0-beta.8
node: 6.2.1
os: win32 x64
npm --version => 3.10.3
You can choose using
ng generate class hero model
@francescopersico you're right, it works thanks ;)
>ng generate class hero model
create src\app\hero.model.spec.ts
create src\app\hero.model.ts
You should update the command line help to add an <options...> like the other command lines
Do you think appending .model should be the default behavior ?
>ng generate class --help
ng generate <blueprint> <options...>
Generates new code from blueprints.
...
Available blueprints
**class <class-type>**
component <name> <options...>
--flat (Boolean) (Default: false)
...
We discussed this at the time and opted to not make default since there were lots of usecases for just having a class. It's true that the ng help documentation is lacking, but in this specific case we couldn't add it since it's a freeform arg.
I tried to create a model with following command but didn't work for me.
ng generate class hero model
$ ng version
@angular/cli: 1.1.0
node: 7.6.0
os: linux x64
when using:
ng generate class hero model
it seems to be back to just creating the file as hero.ts in cli: 1.0.0
ng generate class hero model --no-spec generates hero.ts instead of hero.model.ts
@angular/cli: 1.1.3
node: 8.0.0
os: darwin x64
@Devansh3790 @briancampo @goodlime I created a new issue to track the regression: https://github.com/angular/angular-cli/issues/7121
ng g class contract-details model
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
You can choose using
ng generate class hero model