File Plugin for Ionic 2

HI All :slight_smile:

I was trying to develop a windows 10 application for windows 10 mobiles using Ionic 2, I have a scenario for offline data storage, I tried the sqlite plugin but it was in vain and finally my thoughts end up to use files to store the data using file plugin sadly this plugin returns me this JavaScript run time error: Unable to get property ‘applicationDirectory’ of undefined or null reference. Can someone provide me a working example or any suggestions to solve this issue.

Any help will be appreciated.

Can you share that portion of your code?

However, if you check the file plugin github doc in the where to store files section you find out that some methods are not supported on windows.

Hi @mark2k :slight_smile:

this is the code snippet that i am working on. its taken from the native file plugin page.

import { Component } from '@angular/core';

import { NavController } from 'ionic-angular';

import { File } from 'ionic-native';

declare var cordova: any;


@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {

  fs: string = cordova.file.dataDirectory;

  constructor(public navCtrl: NavController) {

    File.checkDir(this.fs, 'mydir').then(_ => console.log('yay')).catch(err => console.log('boooh'));
  }

}