Preload json file before app start


#1

Hi, Anyone has an example of pre load content(remote json file) before the app start?


#2

#A simple hack can be to get the JSON inside run:

myApp.run(function( $rootScope,  $http ) {
  $http.get('json/data.json').then(function(res){
          $rootScope.mydata = res.data;
    })
})

Then you can access the variable through $rootScope.mydata