将路由从状态提供者转换为路由提供者

时间:2015-06-18 23:06:02

标签: javascript jquery angularjs

我的config.JS上有以下代码,完全正常:

function config($stateProvider, $urlRouterProvider,
    $ocLazyLoadProvider, IdleProvider, KeepaliveProvider,
    adalAuthenticationServiceProvider, $httpProvider) {

    // Configure Idle settings
    IdleProvider.idle(5); // in seconds
    IdleProvider.timeout(120); // in seconds

    //$urlRouterProvider.otherwise("/dashboards/dashboard_1");

    $ocLazyLoadProvider.config({
        // Set to true if you want to see what and when is dynamically loaded
        debug: true
    });

    $urlRouterProvider.when("/dashboard_1", {
        controller: "MainCtrl",
        templateUrl: "/views/dashboard_1.html",
        resolve: {
                        loadPlugin: function ($ocLazyLoad) {
                            return $ocLazyLoad.load([
                                {

                                    serie: true,
                                    name: 'angular-flot',
                                    files: [ 'js/plugins/flot/jquery.flot.js', 'js/plugins/flot/jquery.flot.time.js', 'js/plugins/flot/jquery.flot.tooltip.min.js', 'js/plugins/flot/jquery.flot.spline.js', 'js/plugins/flot/jquery.flot.resize.js', 'js/plugins/flot/jquery.flot.pie.js', 'js/plugins/flot/curvedLines.js', 'js/plugins/flot/angular-flot.js', ]
                                },
                                {
                                    name: 'angles',
                                    files: ['js/plugins/chartJs/angles.js', 'js/plugins/chartJs/Chart.min.js']
                                },
                                {
                                    name: 'angular-peity',
                                    files: ['js/plugins/peity/jquery.peity.min.js', 'js/plugins/peity/angular-peity.js']
                                }
                            ]);
                        }
                    }
    }).otherwise({ redirectTo: "/dashboard_1" });

当我尝试将其转换为使用路由提供程序时:

(function () {
    angular.module('inspinia', [
        'ui.router',                    // Routing
        'oc.lazyLoad',                  // ocLazyLoad
        'ui.bootstrap',                 // Ui Bootstrap
        'pascalprecht.translate',       // Angular Translate
        'ngIdle',                       // Idle timer
        'AdalAngular',                  // ADAL JS Angular
        'ngRoute'                       // Routing
    ])
})();

App.js

{{1}}

我得到一个空白页面,控制台上没有错误。我陷入困境,没有想法在哪里看

http://screencast.com/t/caOYjmZxbGD

0 个答案:

没有答案