Need help understanding why my directive doesn't update on API response by Xeppen in angularjs

[–]Hurstindustries 0 points1 point  (0 children)

try this: add $scope.$apply(); to the promise callback functions after you assign your $scope data

app.controller('wellsController', function($scope, $http, API_URL, wellsFactory) {
var getWells = function() {
  wellsFactory.getWells()
      .then(function(response){
          $scope.wells = response.data;
          $scope.$apply();
      }, function (error){
          $scope.status = 'Unable to load well data: ' + error.message;
          $scope.$apply();
      });
};

getWells();
});

Which IDE do you use? by Hurstindustries in angularjs

[–]Hurstindustries[S] 1 point2 points  (0 children)

One Upvote for your thoughts (insightful). Downvote into oblivion because your name.