title: Write (and read) NFC with ionic 2
body: <p>I want to develop an Ionic2 App wich can read and write NFC tags (Ndef Message).
  I use the Ionic NFC documentation (<a href="https://ionicframework.com/docs/native/nfc/" rel="nofollow noreferrer">https://ionicframework.com/docs/native/nfc/</a>) but that's my first Ionic app and I've a very beginner in web langage too.
  I already developed an Android application using NFC, but I don't really understand how Ionic's and Angular works !</p>
  
  <p>This is my code :
  (html)</p>
  
  <pre><code>&lt;ion-header&gt;    
  &lt;ion-navbar color="primary"&gt;
  &lt;button ion-button menuToggle&gt;
    &lt;ion-icon name="menu"&gt;&lt;/ion-icon&gt;
  &lt;/button&gt;
  &lt;ion-title&gt;&lt;/ion-title&gt;
  &lt;/ion-navbar&gt;
  &lt;/ion-header&gt;
  &lt;ion-content padding&gt;
  
  &lt;br/&gt;
  &lt;button ion-button [disabled]="!isEnabled"&gt;Synchroniser&lt;/button&gt;
  &lt;br/&gt;
  &lt;p&gt;{{infotxt}}&lt;/p&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <p>(TS) :</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { IonicPage, NavController, NavParams, LoadingController,
      AlertController } from 'ionic-angular';
  import { FormBuilder, Validators } from '@angular/forms';
  import { NFC, Ndef } from '@ionic-native/nfc';
  import { EmailValidator } from '../../validators/email';
  import { AuthData } from '../../providers/auth-data';
  import {HomePage}from'../home/home';
  
  
  @Component({
      selector: 'page-syncCard',
      templateUrl: 'syncCard.html',
      providers:[NFC,Ndef]
  })
  
  
  export class syncCard {
    isEnabled :boolean;
    infotxt : any;
    constructor(public navCtrl: NavController, public nav: NavController,private nfc: NFC, private ndef: Ndef) {
        this.nfc.addNdefListener(); 
      }  
  
  ionViewDidEnter(){
          this.isEnabled=false;
          this.nfc.showSettings();
          if (this.nfc.enabled()) {
            this.infotxt="NFC enabled";
          } else {
            this.infotxt='NFC disabled';
          }
  }
  }
  </code></pre>
  
  <p>What I want to do :</p>
  
  <p>I'd like infotext value to be "enabled or "disabled" varying with NFC phone status.
  Then, when the user will put a NFC tag on the phone, my button will be enabled (and disabled again when we take off the nfc tag).
  When the nfc tag is near the phone, if the user click on the button, i want to write something (it will be a string or bytes[]).</p>
  
  <p>Can you help me pls ?</p>
  
  <p>The only example of Ionic NFC is one with Ionic1 or an "outdated" marked git repository</p>
  
  <p>Thaks</p>