使用AngularJS和$ ocLazyLoad加载视图或模板文件后加载依赖项

时间:2016-05-22 11:52:17

标签: javascript angularjs oclazyload

我正在用AngularJS编写一个应用程序。必须使用依赖项脚本激活许多小部件。脚本必须在加载视图内容后运行。我有以下状态;

    .state('dashboard', {
        url: "/dashboard.html",
        templateUrl: "views/dashboard.html",            
        data: {pageTitle: 'Admin Dashboard Template'},
        controller: "DashboardController",
        resolve: {
            deps: ['$ocLazyLoad', function($ocLazyLoad) {
                return $ocLazyLoad.load({
                    name: 'DYSCOApp',
                    insertBefore: '#ng_load_plugins_before',
                    files: [
                        "assets/vendor/jquery-ui/jquery-ui.js",
                        "assets/vendor/jqueryui-touch-punch/jqueryui-touch-punch.js",
                        "assets/vendor/jquery-appear/jquery-appear.js",
                        "assets/vendor/bootstrap-multiselect/bootstrap-multiselect.js",
                        "assets/vendor/jquery.easy-pie-chart/jquery.easy-pie-chart.js",
                        "assets/vendor/flot/jquery.flot.js",
                        "assets/vendor/flot.tooltip/flot.tooltip.js",
                        "assets/vendor/flot/jquery.flot.pie.js",
                        "assets/vendor/flot/jquery.flot.categories.js",
                        "assets/vendor/flot/jquery.flot.resize.js",
                        "assets/vendor/jquery-sparkline/jquery-sparkline.js"

                        //ANGULARJS
                        "angular/controllers/DashboardController.js"
                    ] 
                });
            }]
        }
    })

我想在templateUrl之后加载JS文件:" views / dashboard.html"文件已完成加载。

0 个答案:

没有答案