title: If condition using storage.set is not working in Ionic
body: <p><strong>Brief Explanation of what is happening:</strong>  When I open the app on mobile, it directly takes me to <code>dashboard.html</code> from <code>login.html</code></p>
  
  <p><strong>What I am trying to achieve:</strong>  When app is opened for the 1st time, after giving username and password, on success response username and password information is saved in local storage. From the next time when app is opened, app goes to login.html, in its <code>ngOnInit()</code> it checks if user is already logged in then it navigates to 'dashboard.html<code>else stays at</code>login.html` page.</p>
  
  <p>But it takes me to <code>dashboard.html</code> even at the very first time after app is installed. What am I doing wrong ?</p>
  
  <p><code>login.ts</code> code:</p>
  
  <pre><code>  ngOnInit()
  {
  
  if(this.storage.get('user').then((val) =&gt; {
    if(val===''){
      console.log("this key does not exists");
      this.storage.set('user','');
    }
    else {
      this.navCtrl.setRoot(DashboardPage);
      console.log('user::',val);
    }
  
      console.log("i am out of if");
  
   }))
   {
  
   }
  {console.log('user',val);});
  }
  </code></pre>
  
  <p>Please check my if condition and let me know what needs to be done.</p>