Skip to content Skip to sidebar Skip to footer

Angularjs Service Doesn't Work In My Case

Below is an element is within my mainController and my js look like this //service app.service('request_service', function(){

Solution 1:

You request a value of your service and you do not watch it for changes. Therefore it will most likely (depending on the sequence and time your controllers are initialized) be false and remain false.

$scope.ajaxed = request_service.finished;

If you want to know when the request_service.finished changes, it should be watched:

$scope.isFinished = aService.isFinished;

$scope.$watch(function() { return aService.isFinished; }, function(newV, oldV) {
    $scope.isFinished = newV;
});

Post a Comment for "Angularjs Service Doesn't Work In My Case"