我正在尝试使用meanjs实现filesaver.js。但它不起作用。
可以和meanjs一起使用吗??
我遵循了以下步骤。
1-安装filesaver文件后,使用以下命令通过bower上传文件:
bower install file-saver --save2-我在我的应用程序布局页面中的config\env\all.js文件中包含了对fileSaver.js文件的引用,如下所示:
assets: {
lib: {
css: [
'public/lib/bootstrap/dist/css/bootstrap.css',
'public/lib/bootstrap/dist/css/bootstrap-theme.css'
],
js: [
'public/lib/angular/angular.js',
'public/lib/file-saver/FileSaver.min.js',
'public/lib/file-saver/FileSaver.js',
]
},3-然后在我的angular应用程序中,通过在下面这行数组的末尾添加' filesaver‘,我将fileSaver作为依赖项包含在文件: public\config.js中:
var applicationModuleVendorDependencies = ['ngResource', 'ngCookies', 'ngAnimate', 'ngTouch', 'ngSanitize', 'ui.router', 'ui.bootstrap', 'ui.utils', 'fileSaver'];4-我正在尝试使用我的meanjs客户端控制器中的以下代码导出到XL工作表。
$scope.export = function($event) {
$event.preventDefault();
$event.stopPropagation();
var blob = new Blob([document.getElementById('exportable').innerHTM], {
type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'
});
saveAs(blob, 'Report.xls');
};我无法在我的视图中使用文件保护程序。它警告说没有定义“saveAs”。
谢谢。
发布于 2014-12-04 17:00:11
我从applicationModuleVendorDependencies中删除了文件保护程序,它起作用了
https://stackoverflow.com/questions/27250591
复制相似问题