How to execute ng-repeat after loading json

I need advice so that my angularJs application works correctly. It should work as follows:

  • request some json data ($ http)
  • set the requested data to $ rootScope.data li>
  • execute ng-repeat after json is available

But what it does is, ng-repeat tries to skip json whish is not available. It spreads undefinedeverywhere.

Help would be greatly appreciated. OliverKK

+4
source share
1 answer

Try the following:

$scope.ngRepData =[];

Then on $http.get('someURL.json').successdo:

$http.get('someURL.json).success(function(data){
    $scope.ngRepData =data;
}

, ngRepeat, ngRepeat, , , HTTP- .

+3

Source: https://habr.com/ru/post/1544460/


All Articles