0

在这里我无法加载 JSON 数据。我在下面的代码中做错了什么。谁能指导我?

app.run(['$route', '$http', '$rootScope', function ($route, $http, $rootScope) 

    {

            $http.get("sampleslist.js").success(function (data) {

                alert(data);

                var loop = 0, currentRoute;

                for (loop = 0; loop < data[0].pages.length; loop++) {

                    currentRoute = data[0].pages[loop];
                    var routeName = "/" + currentRoute.name;
                    $routeProviderReference
                        .when(routeName, {
                            templateUrl: currentRoute.tempUrls + ".html",
                            resolve: {
                                load: ['$q', '$rootScope', function ($q, $rootScope) {

                                    var deferred = $q.defer();

                                    require([

                                       currentRoute.tempUrls + routeName
     ], 

    function () 

    {

                                        $rootScope.$apply(function () {

                                            deferred.resolve();
                                        });

                                    });

                                    return deferred.promise;
                                }]
                            }
                        })
                }
            });

        }]);
4

0 回答 0