title: Show AlertController only one time - Ionic 2 AngularJS 2
body: <p>I added a really basic <code>AlertController</code> in my project in order to give the user a quick introduction to the app but, as its purpose is purely to welcome, I'd like to show it once (the first time the app is opened) so that future times there'll be none. </p>
  
  <p>I included it in <code>ionViewWillEnter()</code> method:</p>
  
  <pre><code>ionViewWillEnter() {
      let alert = this.alertCtrl.create({
        title: 'Title',
        subTitle: 'Subtitle',
        message: 'Message',
        buttons: ['OK'],
        enableBackdropDismiss: false
      });
      alert.present();
    }
  </code></pre>
  
  <p>As a starter in cross-platform development it's the first time I'm facing this problematic or rather what in Android is called SharedPreferences. I've looked at the official documentation of <a href="https://ionicframework.com/docs/v2/api/components/alert/AlertController/" rel="nofollow noreferrer">AlertController</a> but I didn't find very much about the <code>handler</code> inside <code>buttons</code>. </p>
  
  <p>This is what I do on Android to save the preference:</p>
  
  <pre><code>mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
  
      Boolean welcomeScreenShown = mPrefs.getBoolean(welcomeScreenShownPref, false);
  
      if (!welcomeScreenShown) {
  
         AlertDialog.Builder(this)
            .setTitle("Title")
            .setMessage("Message")
            .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener(){
              public void onClick(DialogInterface dialog, int which) {
                  dialog.dismiss();
              }
          }).show();
          SharedPreferences.Editor editor = mPrefs.edit();
          editor.putBoolean(welcomeScreenShownPref, true);
          editor.commit(); // Very important to save the preference
      }
  </code></pre>