Problems adding side menu in project already started

Asked

Viewed 129 times

0

I’m starting with Ionic, have a question.

I created a blank project "Ionic start project Blank", and I was able to create the main screen of my app, just a LOGO with "LOGIN" button to enter the app, but I would like to add a side menu on the LOGIN page. But I’ve been doing some research but I can’t find it, I believe it’s possible.

I would just like to have the Sidemenu on the main screen, however it is not the screen that starts the app, so I could not create with the sidemenu template. It is possible to add a SIDEMENU in a project already created in Blank?

I’m really looking but unsuccessfully.

  • Show the application source code.

  • [ "...could not create with the sidemenu template..." ], When you tried to create with the side menu template Ionic returned you some error? If yes post the screen shot here to improve your question.

1 answer

1

Good Felipe, you can do it in two ways:

1a - Create the app with the sidemenu template and change the main page:

  • Create the app with the sidemenu template
  • Generates a new page with ionic generate page nome_da_pagina
  • Goes in the file app.component.ts and defines the property rootPage with this new page created (the moment you open the file should be like Menupage or something).

When you test you will see that the first page that will open is this new created, then just put a click event on the button and the method using the NavController to push the new view (which will be MenuPage and will have the menu created by Ionic). Take a look at documentation of that case.

2a - Continue the way and generate a page that will be the menu.

  • In this case, generate a new page that will serve as a menu.
  • Follow the instructions of documentation to make the menu according to the standard.
  • Place a click event on the "Sign In" button that will change the rootPage to the menu page.

As you are at the beginning, I recommend following the first way.

  • Thanks for replying Noeyeat, I did as Oce said in the first option, but gives error , setting the rootpage as the one I created, it automatically imports the page above, but still gives error. There’s something else I need to modify?

  • @Felipexst which error gives? Just saying you have error can not help you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.