I am working on a ionic 3 project and I want to open pdf files inside the "assets/pdf" folder. I used ionic-native file opener for this. But it throws an error saying file not found
import { File } from '@ionic-native/file';
import { FileOpener } from '@ionic-native/file-opener';
constructor(private file: File, private fileOpener: FileOpener) { }
public openFile() {
const url = "assets/pdf/unit1.pdf";
this.fileOpener.open(this.file.applicationDirectory + url, 'application/pdf')
.then(() => console.log('File is opened'))
.catch(e => {
console.log('Error openening file', e);
});
}
It seems like an error in the path. But I don't know how to use it.Anyone knows how to use this function?