javascript - NavigatorView's page stack is empty back to main page Onsen UI -
hallo new onsen ui framework. nice framework , beautiful. have problem navigation. main page template, in template type data , save it, automacally again main page. using mynavigator.poppage(). have error navigatorview's page stack empty. here code using sliding menu
index.html
<ons-navigator title="navigator" var="mynavigator"> <ons-sliding-menu close-on-tap main-page="main.html" menu-page="menu.html" side="left" max-slide-distance="250px" var="menu"> </ons-sliding-menu> </ons-navigator> <ons-template id="menu.html"> <ons-list> <ons-list-item modifier="chevron" onclick="menu.setmainpage('nomor.html', {closemenu: true})"> setting nomor </ons-list-item> </ons-list> </ons-template> <ons-template id="nomor.html"> <ons-page ng-controller="penomorancontroller"> <ons-toolbar> <div class="left"> <ons-toolbar-button ng-click="menu.togglemenu()"><ons-icon icon="ion-navicon" style="font-size: 32px; width: 1em;"></ons-icon></ons-toolbar-button> </div> <div class="center"> setting nomor</div> <div class="right"> <div id="prosesajax"></div> </div> </ons-toolbar> <ons-list> <ons-list-item> <input type="text" placeholder="nomor" ng-model="noini" class="text-input text-input--transparent" style="margin-top:8px; width: 100%;"> </ons-list-item> </ons-list> <div class="content-padded"> <ons-button id="btnsignin" modifier="large" ng-click="savedata()"> save </ons-button> </div> </ons-page> </ons-template> angularjs controller
agendaapp.controller('penomorancontroller',function ($scope){ $scope.savedata=function(){ $scope.mynavigator.poppage(); }; }); the problem when clicked save button error navigatorview's page stack empty, what's wrong? answer
menu.setmainpage setting new stack, in case there 1 page (nomor.html) in mynavigator stack. when try poppage there no other page go back.
solution - try mynavigator.pushpage(nomor.html) mynavigator stack push nomor.html stack. can poppage.
Comments
Post a Comment