bug(v4-menu): Menu: must have a "content" element to listen for drag events on.
See original GitHub issueBug Report
Ionic Info
Ionic:
ionic (Ionic CLI) : 4.1.2 (C:\Users\amitm\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.7
@angular-devkit/core : 0.7.5
@angular-devkit/schematics : 0.7.5
@angular/cli : 6.1.5
@ionic/ng-toolkit : 1.0.8
@ionic/schematics-angular : 1.0.6
Cordova:
cordova (Cordova CLI) : 8.0.0
Cordova Platforms : none
Cordova Plugins : no whitelisted plugins (0 plugins total)
System:
NodeJS : v10.1.0 (C:\Program Files\nodejs\node.exe)
npm : 5.3.0
OS : Windows 10
Describe the Bug
When putting the menu inside a custom component, (app-menu
) to make the app component less busy, I get the following error:
Menu: must have a “content” element to listen for drag events on.
Even though I am passing a [content]
input containing element ref for ion-router-outlet
- The menu icon doesn’t show anymore.
Steps to Reproduce
- Generate a new app with menu
ionic g component menu
- Put the
ion-menu
in theapp-menu
- Put the following in
app.component
:
<ion-app>
<ion-split-pane>
<app-menu [content]="content"></app-menu>
<ion-router-outlet #content main [swipeBackEnabled]="true"></ion-router-outlet>
</ion-split-pane>
</ion-app>
Expected Behavior Menu to show, no error to apear
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Menu: must have a 'content' element to listen for drag events ...
It works fine with one exception: when the page loads, there is the following error on the console: Error: "Menu: must have a...
Read more >Menu: must have a “content” element to listen for drag events on
I created a menu component which has the menu-button and the ion-menu inside because i want to use this component on multiple pages....
Read more >Ionic 3 side menu example, menu: must have a "content" element to ...
Ask questions bug(v4-menu): Menu: must have a "content" element to listen for drag events on. That is really awkward. We can avoid that...
Read more >[Resolved]-Ionic4+VueJS hamburger menu - appsloveworld
I'm currently getting this error: Menu: must have a "content" element to listen for drag events on. I'm a bit unsure of what...
Read more >Cisco Prime Network Registrar 8.1 User Guide
IN NO EVENT SHALL CISCO OR ITS SUPPLIERS BE LIABLE FOR ANY INDIRECT, SPECIAL, ... Contents iv. Cisco Prime Network Registrar 8.1 User...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
ion-menu has the contentId property, try switching to
<ion-router-outlet id="content1" ..
and<ion-menu contentId="content1" ..
ion-menu will look in the document
? document.getElementById(this.contentId)
in menu.tsx#L149
Since beta.18 the following is correct:
See: https://github.com/ionic-team/ionic/blob/master/core/src/components/split-pane/readme.md
PS: But you can still use main in ion-router-outlet 😉