我正在用 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:"views/dashboard.html" 文件完成加载后加载 JS 文件。