Leong Sze Kim Leong Sze Kim - 2 months ago 6x
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.

//maybe like this ?
controlProvider.getStatus(function(product) {
    $scope.product = product;