Description
I had my hands on Ionic CLI today, and I usually build my apps with Angular CLI. I heard Ionic CLI integrates well with the Angular CLI (or to be more accurate, using angular CLI) so I thought why not give it a try.
Usually, when I start an app, I structure it like so (in a nutshell):
- App folder contains all of the modules
- Each module (that is not a Core/Shared Module) has pages and dummy components.
I read that there's an option to generate a page
, which is simply a component, with a Page
suffix instead of Component
suffix, and it generates along the way a module for the page, and lastly, it links the generated module to the app routing.
IMO (and people are free to argue about it), the generate page
does much more than just creating a new page, and that limits me to build my app with my own structure. I might have 1 module with multiple pages (e.g AuthModule with login, register, and a profile page).
So my alternative is to use the traditional way by creating a new component
and not a page
. But then, to keep the style guide of Ionic, I would like to have a Page
suffix and not a Component
suffix. Plus, I would like to link the generated component (which would be a page) to the relative module (e.g AuthModule) and not the AppModule, since I've already linked my AuthModule to AppModule.
Activity
imhoffd commentedon Sep 24, 2018
@Newbie012 Okay so to fulfill this feature request, we'd need to add
--without-module
(Do not create a module for this page) to the page schematic. I think that's it, right? The schematics should locate the nearest applicable module to link the page to, but you can also use--module
to specify a specific one.cc @mhartington
Newbie012 commentedon Sep 24, 2018
@dwieeb Yeah, pretty much it :)
JibranYousuf commentedon Sep 29, 2019
I tried generating page without module using
--without-module
but it still created with the module, then I searched and came across--no-module
, which worked perfectly.imhoffd commentedon Sep 30, 2019
Yeah, I think this issue has been resolved.
--no-module
should be the option you're looking for.ciekawy commentedon Jan 3, 2020
hmm
--no-module
does not seem to work for me with recent ionic/angularnmehlei commentedon Mar 21, 2020
I noticed the same behavior like @ciekawy, even with --no-module there are additional files created with a ".module.ts" and "-routing.module.ts" ending. Is this a bug? It does not seem logical to let it generate a module with an option "--no-module". @dwieeb Should this issue be re-opened?
imhoffd commentedon Mar 25, 2020
Yeah, I think we wanted to align it with what the component schematic was doing. I created a PR to add a
--create-module
option (which defaults to true).mhartington commentedon Mar 25, 2020
👋 Hey folks, question.
Are we looking to not generate a module for a page, or are we looking to auto-generate a route for said module?
Technically, pages/components are the same thing, just angular components. Pages only differ because they include routing logic and modify the root route module to add a new path.
Reading over, I wonder if instead of not creating a module, we just have an option to skip the import process
Creates
This would not generate a
foo
entry inapp.routing.module.ts
clemkake commentedon Apr 20, 2021
Hello Team, is there a solution for this so far?