Skip to content Skip to sidebar Skip to footer

How To Pass More Than One Value To Next Page In Angularjs

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

Solution 1:

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

1st page HTML

<divng-controller="dataController"><buttonclass="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);

Post a Comment for "How To Pass More Than One Value To Next Page In Angularjs"