Why doesn't this work? See comments in code below
//factory
app.factory('EstimateDetailFact', function() {
var userinfo = { firstName: 'brad', autoType: '22' };
return {
getinfo: function() {
return userinfo;
},
setinfo: function(arg,value) {
alert( 'you selected: ' + arg + ' ' + value);
arg = value; // Why can't i just say arg = value here? If i say
userinfo.firstName = value, it works just fine. I tried using $eval, and
that didn't do what i wanted either.
return userinfo;
}
}
});
//controller
app.controller('CustInfoCtrl', function($scope, EstimateDetailFact) {
EstimateDetailFact.setinfo('userinfo.firstName','Testy'); //passing two
arguments to the factory
});
Any help appreciated. I have banged my head on this simple thing for hours.
Thanks in advance.
- Brad
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.