mirror of
https://github.com/danielsogl/awesome-cordova-plugins.git
synced 2025-04-01 20:32:55 +08:00
42 lines
913 B
TypeScript
42 lines
913 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Plugin, Cordova, IonicNativePlugin } from '@ionic-native/core';
|
|
|
|
/**
|
|
* @name File Chooser
|
|
* @description
|
|
*
|
|
* Opens the file picker on Android for the user to select a file, returns a file URI.
|
|
*
|
|
* @usage
|
|
* ```typescript
|
|
* import { FileChooser } from '@ionic-native/file-chooser';
|
|
*
|
|
* constructor(private fileChooser: FileChooser) { }
|
|
*
|
|
* ...
|
|
*
|
|
* this.fileChooser.open()
|
|
* .then(uri => console.log(uri))
|
|
* .catch(e => console.log(e));
|
|
*
|
|
* ```
|
|
*/
|
|
@Plugin({
|
|
pluginName: 'FileChooser',
|
|
plugin: 'https://github.com/don/cordova-filechooser.git',
|
|
pluginRef: 'fileChooser',
|
|
repo: 'https://github.com/don/cordova-filechooser',
|
|
platforms: ['Android']
|
|
})
|
|
@Injectable()
|
|
export class FileChooser extends IonicNativePlugin {
|
|
|
|
/**
|
|
* Open a file
|
|
* @returns {Promise<string>}
|
|
*/
|
|
@Cordova()
|
|
open(): Promise<string> { return; }
|
|
|
|
}
|