如何多于一个值传递给在angularjs下页 [英] how to pass more than one value to next page in angularjs
问题描述
你好,我是新手,angularjs和我的演示aplication使用温泉的UI,我在我的应用2页,在此我想两个值传递到下一个页面,我成功路过一个值,但是当我发送第二1瓦特它给我的的ReferenceError异常:餐厅没有定义
我曾尝试concating字符串,但还是同样的事情发生,所以anybuddy请帮我指点迷津,我的code是:
HTML
<附件按钮的onclick = gallery.pushPage(名单-page.html即可,{params:一个'+渣油+',params1:'+ LISTTITLE +'});修改=干净级=NG-分离范围的effeckt键式按钮 - 干净的玻片左NG模型=Data.FirstNameNG模块=cattitle><跨度类=标签项-button-内>
JS
VAR FkCategory = page.options.params;
VAR标题= page.options.params1;
在这里你去哥们..这是很容易做到。
第1页的 HTML
< DIV NG控制器=DataController类>
<按钮类=按钮按钮 - 大 - CTANG点击=下一页()>< /按钮>
< / DIV>
传递的价值观 - JS
myApp.controller('DataController类',函数($范围){
VAR valueSet;
valueSet.value1 =值1;
valueSet.value2 =值2;
$ scope.nextPage =功能(){
yourNavigator.pushPage('destination.html',{动画:defaultTransition,值:valueSet})
};
});
检索值 - JS
VAR valueSet = yourNavigator.getCurrentPage()options.values。
的console.log(valueSet.value1 +与&+ valueSet.value2);
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;
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);
这篇关于如何多于一个值传递给在angularjs下页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!