Is Class available in Ionic Generator? I get strange result


#1

I am familiar with Angular CLI which provides ‘Class’ generator. So we can create a typescript file with simple class declaration with following command:

ng g class Foo

In CLI help, Ionic shows only following items it can generate:

ionic generate - Generate pipes, components, pages, directives, providers, and tabs (ionic-angular >= 3.0.0)

But I tried to use same command with Angular CLI:

ionic g class Foo

and got result:

[OK] Generated a class named FireBaseEnvironment!

First, I glad it looks work well in Ionic project here. But after finding for that fresh-generated class file, it looks like there isn’t real file generated.

Does Ionic generator really support ‘Class’? if yes, where would it be placed in project? or I am misunderstand something?


#2

Why do you want to generate a Class?

It isn’t offered by ionic generate, so if it does something on calling that command this looks more like a bug to me.

Update:

PS C:\Users\Jan\Documents\superTest> ionic g telephone foo
[OK] Generated a telephone named foo!

Yeah, seems like a CLI bug :wink:


#3

I create an issue for it: https://github.com/ionic-team/ionic-cli/issues/2439


#4

@Sujan12 Thank for make it clearly it’s bug! :smiley:

Anyway, I think it would more handy if Ionic’s generator can generate ‘Class’ like Angular CLI do. In some case, a solid class is useful.


#5

You know the link to the repo now :wink: