Custom URL for a ionic page


#1

In the ionic page I have added

@IonicPage({
  name: 'login-page',
  segment: 'login'
})

When I am trying to open them using url

http://localhost:8100/#/login

I’m getting error as

Uncaught (in promise): Error: Type LoginPage is part of the
declarations of 2 modules: AppModule and LoginPageModule! Please
consider moving LoginPage to a higher module that imports AppModule
and LoginPageModule. You can also create a new NgModule that exports
and includes LoginPage then import that NgModule in AppModule and
LoginPageModule. Error: Type LoginPage is part of the declarations of
2 modules: AppModule and LoginPageModule! Please consider moving
LoginPage to a higher module that imports AppModule and
LoginPageModule. You can also create a new NgModule that exports and
includes LoginPage then import that NgModule in AppModule and
LoginPageModule.

& sometimes it’s opening the root page (Homepage/first page) but it does not navigate to loginPage. I have imported the page in the app.module.ts
How can I solve it?


#2

The presence of the @IonicPage declaration makes the page lazily loaded, which means that it needs to get out of the app module.


#3

should i remove the import from app.module.ts.