I am using ionic-cli 2
for generating pages for my ionic
project. I would like keep my pages separately in different folders . For example , I would like to keep pages like Login
, Signup
in a separate folder called authentication
. But at the same time I would like to enjoy the ionic generate page
command to quickly setup the page inside the authentication
folder. Currently ionic-cli
would generate the pages in pages
folder. How can I make it in pages/authentication
folder ?
I know it's been a while, but this worked for me using the @latest ionic (3.12.0)
Generate "sub-pages" from the app's root folder as you would generate "top-level" pages. Then, drag them to their intended place using Visual Studio Code.
Obviously you want to rename stuff such as modules and classes. For example, for the 'home' and 'standings' sub-pages of the 'team' page, I renamed the classes from HomePage
and StandingsPage
to TeamHomePage
and TeamStandingsPage
respectively.
Alternatively (and in retrospect recommended), name the pages using the desired structure, e.g., ionic generate page team-home
(you'll still have to move them manually). This is especially useful for repeating patterns, e.g., if you also want 'home' and 'standings' sub-pages for say a 'tournaments' page.
Also see Can ionic2's pages support nested directory structure?.