Onsen ui navigation with parameters

懵懂的女人 提交于 2019-12-01 22:36:53

You say every page looks like the one you pasted. Do you have several <ons-navigator> tags? You should really only need one.

If you do

$scope.navigator.pushPage('somepage.html', {param1: 'bla'});

You should be able to do

console.log($scope.navigator.getCurrentPage().options.param1);

See pen:

http://codepen.io/argelius/pen/OPJRPe

Do you have the navigator attached to some scope that is parent of the scope of the controller for the page you push?

In your parent controller you could do:

ons.ready(function() {
  $scope.navigator = $window.myNavigator
});

And then use that object in the child controllers.

I facing same problem, my solution for this is basicaly combine both in something like this

<ons-sliding-menu
        menu-page="menu.html"
        side="left"
        max-slide-distance="250px" 
        var="menu">
        <div class="main">
            <ons-navigator title="Navigator" var="myNavigator" page="home.html"></ons-navigator>
        </div>          
    </ons-sliding-menu>

In this way you can use both SlideMenu and Navigator pattern

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!