【发布时间】:2015-04-07 07:13:13
【问题描述】:
return{ // this code is in index.js
addItem: function () {
alert("working");
Newram.show().then(function (response) `***// Calling show functionin Newram.js***`
{
var c = response;
}
);
}}
// In Newram.js while closing the popup i tried to send data to the **response** in index.js but empty string or undefined is showing
var AddItem = function () {
var self = this;
self.Name = ko.observable('jo'),
self.Price = ko.observable(100),
self.Sales = ko.observable("good")
self.data1= {name:self.Name() };
};
AddItem.prototype.closeDialog = function () {
dialog.close(this, self.Name);
};
即使我尝试了这段代码(dialog.close(this,ko.toJS(self.Name))),我也无法在关闭弹出窗口时传递可观察的数据......无法在response 但如果我传递一个字符串,它可以在响应中使用
【问题讨论】:
-
self没有在closeDialog方法中定义,尝试用this替换它 -
如果我使用 "this" .....self.Name 未定义
标签: javascript json knockout-2.0 durandal-2.0