You cannot put the ons-page element in the ons-navigator

On an Android device, I get this error when loading the onsenui page. this is due to the http://onsenui.io javascript library.

You cannot put the ons-page element in the ons-navigator.

+5
source share
2 answers

If there was not a single page, ons-navigator has nothing to go to :)

if you are not using the built-in ons page, make sure it loads the page:

<body ng-app ng-controller="MyCtrl"> <ons-navigator var="myNavigator" page="mainPage.html"> </ons-navigator> </body> </html> 
+2
source

As the answer of Vu Nguyen is somewhat correct, but in fact it does not explain other scenarios where this can happen, I will share my decision on this issue. For me, the problem arose when I upgraded to Onsen UI 1.3.0 from 1.1.4, and the point where I got this error was on navigator.pushPage('page1.html') , where page1.html looked like this:

 <ons-template id="page1.html"> <ons-sliding-menu menu-page="menu.html" main-page="browse.html" side="left"> </ons-sliding-menu> </ons-template> 

Now, the Onsen user interface cannot find the on-page page, which for some reason is not needed before. So the solution is to wrap the menu of the ons-sliding menu on the ons page, like this

 <ons-template id="page1.html"> <ons-page> <ons-sliding-menu menu-page="menu.html" main-page="browse.html" side="left"> </ons-sliding-menu> </ons-page> </ons-template> 
+3
source

Source: https://habr.com/ru/post/1201384/


All Articles