如何将参数传递给模式弹出窗口? [英] how to pass parameters to modal popup?
本文介绍了如何将参数传递给模式弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Nativescript
应用程序,需要在单击列表项时打开视图.因此,我将必须将该项目的id
传递给将在单击列表项目时打开的模式.
I am working on Nativescript
application where i need to open view on click of list item. So i will have to pass id
of that item to the modal that is about to open on click of list item.
这是我尝试打开模式弹出窗口时的代码:
Here is my code as i tried and for opening modal popup :
var modalPageModule = views.appointmentDetails;
var context = {
id: args.view.bookingId // i tried this way for passing parameter
};
var fullscreen = true;
page.showModal(modalPageModule, context, function closeCallback(parameters) {
// Log the user in...
}, fullscreen);
以及用于在模式弹出窗口的控制器上获取参数的代码
And code for getting passed parameter on controller of modal popup
page = args.object;
var gotData = page.navigationContext;
var id = gotData.id;
但返回NaN
.
请提出一些将变量传递给模式弹出窗口的方法.
Please suggest some way to pass variable to modal popup.
推荐答案
在XML文件中进行更改后问题已解决
Problem solved after making change in XML file
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:widgets="utils/widgets"
showingModally="onLoaded">
并在模式控制器中
exports.onLoaded = function(args) {
var id = args.context.id
这篇关于如何将参数传递给模式弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文