[英]how to pass parameters to modal popup?
I am working on Nativescript
application where i need to open view on click of list item. 我正在使用Nativescript
应用程序,我需要在列表项单击时打开视图。 So i will have to pass id
of that item to the modal that is about to open on click of list item. 因此,我必须将该项目的id
传递给即将单击列表项目时打开的模式。
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;
But returns NaN
. 但是回归NaN
。
Please suggest some way to pass variable to modal popup. 请建议一些方法将变量传递给模态弹出窗口。
Problem solved after making change in XML file 在XML文件中进行更改后问题得以解决
<Page xmlns="http://schemas.nativescript.org/tns.xsd"
xmlns:widgets="utils/widgets"
showingModally="onLoaded">
and in modal controller 并在模态控制器中
exports.onLoaded = function(args) {
var id = args.context.id
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.