title: how can i store the user Id after login using ionic2 framework
body: <p>i'm new to ionic 2 and i have a problem in storing my user data that i have stored in a class in my injectable service for login please help me:</p>
  
  <p><strong>auth-service.ts</strong></p>
  
  <pre><code>   export class User {
     nom: string;
     email: string;
  
       constructor(nom: string, email: string) {
      this.nom = nom;
      this.email = email;
   }
  }
      @Injectable()
       export class AuthService {
       currentUser: User;
       members: Array&lt;any&gt;;
       nomUser:string;
       emailUser:string;
  
          constructor(public http: Http) {
                 console.log('Hello Authentification');
               }
  
        public login(credentials) {
        if (credentials.email === null || credentials.password === null) {
         return Observable.throw("Please insert credentials");
         } else {
          return Observable.create(observer =&gt; {
          var url = 'http://localhost/PFEBACKEND/login-client.php?
         email='+credentials.email+'&amp;passe='+credentials.password ;
  
           this.http.get(url).map(res =&gt; res.json()).subscribe(
            data=&gt;{                                                                       
                  let access = (data.error=== 0 )
  
                   this.currentUser = new User( data.nom,data.email);
  
                   console.log(this.currentUser);
                     observer.next(access);  
                     observer.complete(); 
                      },
                      err =&gt; {
                      console.log(err);
                      },
                        () =&gt; console.log('authentifié') );
  
                  });
     }
  
            public getUserInfo()  {
              return  this.currentUser ;
            }
  </code></pre>
  
  <p><strong>home.ts</strong></p>
  
  <pre><code>import { AuthService } from '../../providers/auth-service';
  import { Http, Headers, RequestOptions } from '@angular/http';
  import {Observable} from 'rxjs/Observable';
  import { Component,Inject } from '@angular/core';
  import { NavController, NavParams,LoadingController  } from 'ionic-angular';
  
      export class HomePage {
            nom:string= '';
            email:string= '';
  
      constructor(public http: Http,public navCtrl: NavController, private 
      auth:AuthService,public data:Datamembers, public navParams:NavParams, 
       public loadingCtrl:LoadingController)
     {      
       let info = this.auth.getUserInfo();
       this.email = info.email;
       this.nom = info.nom; 
     }
    }
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <blockquote>
    <p>nav-controller-base.js:88 Failed to navigate:  Cannot read property 
    'email' of undefined    (anonymous) @ nav-controller-base.js:88<br>
    core.es5.js:1085 
        ERROR Error: Uncaught (in promise): TypeError: Cannot read property 
        'email' of undefined</p>
  </blockquote>