Issue with variable string not updating
var angulargap = angular.module("angulargap", []);
angulargap.factory('cartService', function($rootScope,$http){
var fac ={
message:"factory",
getCart:function(call){
$http.post("/rpc.php", {app:"get_cart",pag:"cart"})
.success(function(data, status, headers, config) {
fac.setMessage("success");
}).error(function(data, status, headers, config) {
});
},
setMessage:function(m){fac.message=m;}
}
return fac;
});
angulargap.controller("iridium", function ($scope,cartService){
cartService.getCart();
$scope.message=cartService.message;
});
Instead of updating an array, everything works fine. What could be the issue here? Thanks