unserver-unify
Version:
37 lines (34 loc) • 957 B
JavaScript
;
angular.module('bamboo.common').service('previewFileHelper', previewFileHelper);
previewFileHelper.$inject = ['$uibModal'];
function previewFileHelper($uibModal) {
var vm = this;
vm.preview = function(filename,absURL) {
var fileType = getFileSuffix(filename);
var conf = {
type: fileType,
absURL: absURL
}
openModal(conf);
}
function getFileSuffix(filename) {
//console.log(filename);
return filename.split('.').pop().toLowerCase();
}
function openModal(fileconfig) {
var instance = $uibModal.open({
templateUrl: 'components/dialog/attachmentpreview.dlg.html',
size: 'lg',
controller: 'AttachmentPreviewDlgCtrl',
backdrop: 'static',
controllerAs: 'ctrl',
resolve: {
config: function() {
return fileconfig;
}
}
}).result.then(function(item) {
console.log("ok");
});
}
}