我嘗試爲Supercontainer對象創建一個getter和setter,但似乎沒有工作。AngularJS工廠getter和setter對象
PrometeiaECAProModuleMain.factory('ParameterFactory', [function() {
var Supercontainer = function (userId, supercontainerId, bankId) {
this.userId = userId;
this.supercontainerId = supercontainerid;
this.bankId = bankId;
};
return {
setSupercontainerParam: function (userId, supercontainerid, bank) {
supercontainer = new Supercontainer(userId, supercontainerid, bank);
},
getSupercontainerParam: function() {
return supercontainer;
}
};
}]);
問題質量低:什麼是錯誤?你想達到什麼目的? –