我用nvd3。我下载了库,然后将库添加到我的资产文件夹中,并将库文件包含在我的路由文件中。然后我可以直接在我的控制器上使用
仪表板控制器:
var app = angular.module('dashboard.controller',['nvd3','ui.bootstrap','ui.utils']);
路线文件:
.state('app.dashboard', {
url: '/dashboard',
templateUrl: 'app/components/dashboard/dashboardView.html',
data: {
title: 'Dashboard',
},
resolve: {
deps: ['$ocLazyLoad', function ($ocLazyLoad) {
return $ocLazyLoad.load([
{
insertBefore: '#load_styles_before',
files: [
'assets/libs/nvd3/nv.d3.min.css',
'assets/libs/datatables/css/jquery.dataTables.css' ]
},{
name: 'nvd3',
serie: true,
files: [
'assets/libs/d3/d3.min.js',
'assets/libs/nvd3/nv.d3.min.js',
'assets/libs/angular-nvd3/angular-nvd3.min.js',
'assets/libs/datatables/js/jquery.dataTables.js',
'assets/libs/bootstrap-datatables/bootstrap-datatables.js',
'app/components/dashboard/warning.js',
'assets/libs/moment/moment.min.js'
]
}
]).then(function () {
return $ocLazyLoad.load('app/components/dashboard/dashboardController.js');
});
}]
}
})