how to pass more than one value to next page in an

2019-09-11 09:33发布

问题:

hello i am newbie to angularjs and using onsen ui in my demo aplication,i have 2 pages in my application,In this i want to pass two values to the next page,i succeed to passing one value but when i am sending second onew it gives me exception of ReferenceError: Restaurant is not defined, i have tried concating string but still same thing happened,so can anybuddy please help me to figure it out,my code is: html

<ons-button onclick=gallery.pushPage("list-page.html",{params:'+resid+',params1:'+listtitle+'}); modifier="clean" class="ng-isolate-scope effeckt-button button--clean slide-left"  ng-model="Data.FirstName" ng-module="cattitle"><span class="label ons-button-inner">

js

  var FkCategory = page.options.params;
         var title = page.options.params1;

回答1:

Here you go buddy.. It is really easy to do..

1st page HTML

<div  ng-controller="dataController">
   <button class="button button--large--cta" ng-click="nextPage()"></button>
</div>

passing values - JS

myApp.controller('dataController', function ($scope) {
    var valueSet;
    valueSet.value1 = "value1";
    valueSet.value2 = "value2";
    $scope.nextPage = function () {
        yourNavigator.pushPage('destination.html', { animation: defaultTransition, values: valueSet })
    };
});

retrieving values - JS

var valueSet = yourNavigator.getCurrentPage().options.values;
console.log( valueSet.value1 + "& " + valueSet.value2);