在js文件中,我将模态的视图定义为
var CustomDialog = require('./customModal')
var DialogModel = require('./ MyModel') 但是,我的DialogModel需要在其activate方法中作为参数。 MyModel的路由定义为采用参数,其activate方法定义为
function activate(routedata){
....
}
要打开对话框,我有
var routedata = 90;
this.dialog = new CustomDialog('My title', new DialogModel());
this.dialog.show()
如何将此路线数据传递到路径?
答案 0 :(得分:1)
您应该在show
中传递激活数据:
var routedata = 90;
this.dialog = new CustomDialog('My title', new DialogModel());
this.dialog.show(routedata);
并在CustomDialog中代理它:
define(['plugins/dialog'], function (dialog) {
var CustomModal = function (title, model) {
this.title = title;
this.model = model;
};
CustomModal.prototype.ok = function() {
dialog.close(this, this.model);
};
CustomModal.prototype.show = function(activationData){
return dialog.show(this, activationData);
};
return CustomModal;
});