Reputation: 4611
As you can see(below) I have a factory provider which I inject into another factory. There, I attempt to set one of the values on infoPMIDs
. This is not working. Somehow, when I call infoPMIDs
in a controller it still has the values a = '', b = '', c = ''
summariesApp.factory('infoPMIDs', [function () {
var a = '', b = '',
c = '';
return {
a: a,
b: b,
c: c
}
}]);
summariesApp.factory('getPMIDs', ['infoPMIDs', function (infoPMIDs) {
return function (Tab, other, drug) {
var value = ['value1', 'value2'];
infoPMIDs.genePhenotype = value;
}
}]);
Thanks in advance.
Upvotes: 0
Views: 36
Reputation: 1009
if you want to update a,b,c in infoPMIDs then you'll have to expose some functionality to do so:
.factory('infoPMIDs', [function () {
var a = '', b = '', c = '';
return {
a: a,
b: b,
c: c,
setA: function(val){
a = val;
},
setB: function(val){
b = val;
},
setC: function(val){
c = val;
},
}
}]);
or something similar
Upvotes: 2