Reputation: 115
I created a project using the sidemenu template.
ionic start projectName sidemenu --v2
after that i generated another page using: ionic g page pageName
what I want to do is to add this generated page to the side menu.
can you please help me, I'm newbie to ionic.
Thanks in advance
Upvotes: 1
Views: 2549
Reputation: 65860
You have to add your new page to the pages array
as shown below.
Git repo: Sample Side menu
app.component.ts
import { PageNamePage } from "../pages/page-name/page-name";
export class MyApp {
this.pages = [
{ title: 'Page One', component: Page1 },
{ title: 'Page Two', component: Page2 },
{ title: 'Page Three', component: PageNamePage }//your new page
];
}
You have to add new page as shown below inside the app.module.ts
.I have removed default code for clarity.
app.module.ts :
import { PageNamePage } from "../pages/page-name/page-name";//your new page
@NgModule({
declarations: [
PageNamePage,//new page
],
entryComponents: [
PageNamePage,//new page
],
})
export class AppModule { }
Side Menu Now :
Upvotes: 5