Monaca Onsen UI Discord Chat Github Repo

Cannot call method '$new' of undefined in loader.js

  • I am creating a small app with a sliding menu and a navigator, however it is not working properly: it shows me the message in the title whenever I try to push a page with the navigator after having set a new main stage through the sliding menu. For example:

    I open my App and push a new page and then pop it. Everything ok.

    BUT if I open my app and set a new main stage through the sliding menu and then push a new page it shows “Cannot call method ‘$new’ of undefined in loader.js (…)”.

    What does this mean? I know the controller of the pushed page doesn’t get executed because the alert() I set up never shows. (however if i put an alert onclick of the button that gets to the page it does show up)

    Edit: the sliding menu always sets the main stage to the same page but sends different options

  • Well, I did not understand why but I found the problem. I can’t have a sliding-menu with a main-page being a navigator. I had this:

    <ons-template id="mainpage.html">
           <ons-navigator var="main.nav" page="html/users/login.html" animation="slide">

    But this does not work and gives that error. If I set the sliding menu to a external page and only called in html/users/login.html the error won’t show.

    I just thought I would give my solution if anyone else gets this