title: How to write data into csv file from ionic form?
body: <p>I am newbie to Ionic.
  I have two fields in the form</p>
  
  <pre><code>&lt;ion-item&gt;
      &lt;ion-label floating&gt;Name&lt;/ion-label&gt;
      &lt;ion-input #name type="text"&gt;&lt;/ion-input&gt;
  &lt;/ion-item&gt;
  
    &lt;ion-item&gt;
      &lt;ion-label floating&gt;school&lt;/ion-label&gt;
      &lt;ion-input #school type="text"&gt;&lt;/ion-input&gt;
    &lt;/ion-item&gt;
  
  &lt;div padding&gt;
    &lt;button block ion-button (click)="SaveForm()"&gt;Save data&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>After user clicking on the save button, I want to save the data in csv format in local file system. </p>
  
  <p>I tried</p>
  
  <pre><code>SaveForm()
  {
  
      var finalCSV = this.name.value+','+this.school.value;
       alert('finalCSV');
        $cordovaFile.writeFile(cordova.file.externalRootDirectory, 'data.csv', finalCSV, true).then(function(result){
              alert('Success! Export created!');
            }, function(err) {
              console.log("ERROR");
            })
  
  }
  </code></pre>
  
  <p>In the same ts file I have added</p>
  
  <pre><code>import {File} from 'ionic-native';
  declare var cordova:any;
  
  const fs:string = cordova.file.dataDirectory;
  File.checkDir(this.fs, 'mydir')
      .then(_ =&gt; console.log('yay'))
      .catch(err =&gt; console.log('boooh'));
  </code></pre>
  
  <p>I am getting following Error</p>
  
  <blockquote>
    <p>Typescript Error Cannot find name '$cordovaFile'.</p>
  </blockquote>
  
  <p>How to resolve this Error?</p>
  
  <p>Is there any better approach to implement this?</p>