I am new to Ionic, and I am developing a basic app in Ionic 4 with sidemenu
.
I am adding a button in Side Menu, when I am clicking on t
Simply encapsulate your ion-button
within an ion-menu-toggle
element, like so:
Toggle Menu
View the documentation here
EDIT:
If you don't want to use ion-menu-toggle
, you can do this instead:
In your app.component.ts:
import { MenuController } from '@ionic/angular'; //import MenuController to access toggle() method.
@Component({
selector: 'app-root',
templateUrl: 'app.component.html'
})
export class AppComponent {
constructor(
public menuCtrl: MenuController
) {
this.initializeApp();
}
toggleMenu() {
this.menuCtrl.toggle(); //Add this method to your button click function
}
}
And in your app.component.html:
Toggle Menu
To view all methods, check the docs here.