Im reworking my app to load the page after the data is loaded. I have the data, but i need to get it to my other two controllers. I have a self provoking function inside my main app.js. I also have a service in there.
I am unable to figure out how to reference the service, in the function, so i can add the data there. Therefore, be accessible from my other controllers.
Here is the app.js with the function i need to reference the service and the service itself. I will post the full code.
var app = angular.module('UtilityApp', ['ngRoute', 'ngDialog', 'uiSwitch', 'ui.select', 'ngResource', 'ui.bootstrap'])
.config(
    [ '$routeProvider', function($routeProvider) {
        $routeProvider.when('/edit', {
            templateUrl: 'templates/login-page.html',
            controller : 'LoginController'
        });
        $routeProvider.otherwise({
            resolve:{
                'LoginServiceData':function(LoginService){
                    return LoginService.promise;
                }},
            templateUrl: 'templates/Homepage.html'
        });
    }]);
(function($scope, UserService) {
var initInjector = angular.injector(['ng']);
var $http = initInjector.get('$http');
    $http.get('rest/userdata/').
    success(function (data) {
       //  angular.module('metadata', []).constant('userdata', data);
        // UserDataService.setUserData(data);
        angular.element(document).ready(function() {
            angular.bootstrap(document, ['UtilityApp']);
        });
    }).
    error(function (error) {
        console.log(error.message);
    });
setInterval(function(){
    $scope.getMetaData();
}, 300000);
})();
Hopefully, theres a way to use the UserService in the function. I added it as a parameter but it cant find setUserData.
EDIT I need a way to get the data from the $http.get to the other controllers I have not shown in different js files
