Reputation: 1328
I tried to follow this tutorial : https://devdactic.com/ionic-2-images/
But when I import "FilePath" I have this error :
[12:06:45] typescript: C:/xampp/htdocs/AppFineMobile/src/pages/send-document/send-document.ts, line: 58
Cannot find name 'FilePath'.
L57: if (this.platform.is('android') && sourceType === Camera.PictureSourceType.PHOTOLIBRARY) {
L58: FilePath.resolveNativePath(imagePath)
L59: .then(filePath => {
[12:06:45] build finished in 4.21 s
I run all this commands and the plugin is successful installed :
ionic plugin add cordova-plugin-camera
ionic plugin add cordova-plugin-file
ionic plugin add cordova-plugin-file-transfer
ionic plugin add cordova-plugin-filepath
Someone have an idea ?
Upvotes: 1
Views: 1195
Reputation: 71911
At the top of your send-document.ts
you should add the FilePath
import:
import {FilePath} from 'ionic-native';
TypeScript says that it cannot find it, which suggests you forgot to import it.
According to the github readme of this plugin, it creates a window.FilePath
variable when you install the plugin. There are also no typings available.
My guess is that you actually have to remove the FilePath
import and just declare the variable itself at the top:
declare const FilePath: any;
Upvotes: 2