I generated a new page in ionic 3 using the generate command. When I try adding it to the app module it throws the following error,
Uncaught Error: Unexpecte
In ionic 3. Each page is by default setup as a separate module in order to implement lazy loading of pages.
Your page will be declared in new-todo.module.ts.
@NgModule({
declarations: [
NewTodo
],
imports: [
IonicPageModule.forChild(NewTodo)
],
entryComponents: [
NewTodo
]
})
Check out IonicPageModule docs as well as IonicPage.
In your component new-todo.ts page, add the @IonicPage()
decorator above the component decorator.
@IonicPage()
@Component({
selector: 'page-new-todo',
templateUrl: 'new-todo.html',
})
Also remove all imports to this page outside of the page module. Use the string 'NewTodo'
instead of the imported class when pushing the page in NavController.
You dont have to declare the page in app.module.ts