Notice: The Monaca & Onsen UI Community Forum is shutting down.
For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.
Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.
myNavigator is not defined
mentizm last edited by
Hi me again,
im using the USAGE of the ons-navigator (https://onsen.io/reference/ons-navigator.html).
By click on the “Push Page” button the page throws an error: myNavigator is not defined.
i included this js files:
can someone help me. did i make a mistake.
argelius last edited by argelius
Hi @mentizm !
You need to use the
varattribute of the
<ons-navigator var="myNavigator"> ... </ons-navigator>
By doing this, it is bound as a variable and you can access it with
Here is a simple example on Codepen that illustrates this:
In the case you are using the Onsen UI 2.0 beta, you also need to include
onsenui-angular.jssince we’ve split the AngularJS bindings to a separate file.
Also, if you are not using AngularJS, the
varattribute does not work. Instead you can just select the element and push the page:
var navigator = document.getElementById('my-navigator') navigator.pushPage('page.html');