Skip to content
This repository was archived by the owner on Sep 15, 2021. It is now read-only.

Commit 08970d0

Browse files
created module and factory for fileOpener2 plugin
1 parent eff1f1e commit 08970d0

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

src/plugins/fileOpener2.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// install : cordova plugin add https://github.com/pwlin/cordova-plugin-file-opener2
2+
// link : https://github.com/pwlin/cordova-plugin-file-opener2
3+
4+
angular.module('ngCordova.plugins.fileOpener2', [])
5+
6+
.factory('$cordovaFileOpener2', ['$q', function ($q) {
7+
8+
return {
9+
10+
open: function(file, type) {
11+
12+
var q = $q.defer();
13+
cordova.plugins.fileOpener2.open(file, type, {
14+
error: function(e) {
15+
q.reject(e);
16+
},
17+
success: function() {
18+
q.resolve();
19+
}
20+
});
21+
return q.promise;
22+
23+
},
24+
25+
uninstall: function(pack) {
26+
27+
var q = $q.defer();
28+
cordova.plugins.fileOpener2.uninstall(pack, {
29+
error: function(e) {
30+
q.reject(e);
31+
},
32+
success: function() {
33+
q.resolve();
34+
}
35+
});
36+
return q.promise;
37+
38+
},
39+
40+
appIsInstalled: function(pack) {
41+
42+
var q = $q.defer();
43+
cordova.plugins.fileOpener2.appIsInstalled(pack, {
44+
success : function(res) {
45+
q.resolve(res);
46+
}
47+
});
48+
return q.promise;
49+
50+
}
51+
52+
};
53+
54+
}]);

0 commit comments

Comments
 (0)