javascript - Unset object property -
i have provider: advicelist.provider('$advicelist',function(){ this.$get = function ($rootscope,$document,$compile,$http,$purr){ function advicelist(){ $http.post('../sys/core/fetchtreatments.php').success(function(data,status){ this.treatments = data; console.log(this.treatments); // correct object }); this.advicecategories = [ // available in controller ]; } return{ advicelist: function(){ return new advicelist(); } } } }); further, have controller: advicelist.controller('advicelistctrl',function($scope,$advicelist){ var adv = $advicelist.advicelist(); $scope.treatments = adv.treatments; // undefined }); why it, controller's $scope.treatments stays undefined, this.treatments inside provider however, filled correctly? also, advicecategories available in contr...