Leong Sze Kim Leong Sze Kim - 1 year ago 49
AngularJS Question

Angular.JS service not working

I stuck on this for quite some time. My service didn't work as in it didn't get data from my expected. But it working fine if I put the

request in my controller.


function controlProvider($http) {
this.getStatus = function (callback){
.success(function (data) {

controlApp.service('controlProvider', controlProvider);

function controlController ($scope,controlProvider){
controlProvider.getStatus = (function (product) {

$scope.product = product;
controlApp.controller("controlController", controlController);


Any help advise will be greatly appreciated. Thank you.

Answer Source
//maybe like this ?
controlProvider.getStatus(function(product) {
    $scope.product = product; 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download