在使用kendo UI导航屏幕时如何在参数中发送json对象

时间:2016-05-12 12:56:24

标签: ios angularjs kendo-mobile

我正在使用Kendo UI-AngularJS,我们创建了包含多个屏幕(html页面)的iOS移动应用程序,并且用于从一个html导航到另一个html我们使用“kendo.mobile.application.navigate(test.html) );”

我们想要传递test.html屏幕的JSON对象。 JSON对象包含对象数组。怎么通过呢?

我知道如果我们想要传递一个参数,那么我们就可以传递“kendo.mobile.application.navigate(test.html?name ='testName');”,但我们想要传递JSON对象。我们如何实现它?

2 个答案:

答案 0 :(得分:0)

您可以先对对象进行字符串化,然后将其作为参数传递,例如:

var my_object = {};
my_object.title = "hello";
my_object.price = "15"
window.location.href = "test.html?response=" + JSON.stringify(my_object);

在详细视图中,您可以像这样接收此对象:

//onShow event
function fooShow(e) {
var my_params = JSON.parse(e.view.params.response)
console.log(my_params) 
}

答案 1 :(得分:0)

由于maximum length limitation of a URL

,请勿在网址中传递它

而是在localStorage

中传递普通的JSON对象