title: How to display data from server in angularv8
body: <p>I would like to display the name of the person who logged in the app. I tried this </p>
  
  <pre><code>getprotected() { 
  return this.http.get(${this.url}/api/protected_things)
     .pipe( 
        catchError(e =&gt; { 
           let status = e.status; 
           if (status === 401) { 
              this.showAlert('You are not authorized for this!'); 
              this.logout(); 
           } 
           throw new Error(e);
        }) 
     ) 
  } 
  </code></pre>
  
  <p><strong>tab1.ts</strong></p>
  
  <pre><code>export class Tab1Page implements OnInit {
  
    data = '';
  
    constructor(private authService: AuthService, private storage: Storage, private toastController: ToastController, private http: HttpClient) { }
  
    ngOnInit() {
  
        this.authService.getprotected().subscribe(res =&gt; {
         this.data = res['name'];
         });
    }
  </code></pre>
  
  <p><strong>tab1.html</strong></p>
  
  <pre><code>&lt;p class="ion-text-center"&gt;Bienvenu&lt;/p&gt;
  
    &lt;p class="ion-text-center"&gt;&lt;b&gt;{{ data }}&lt;/b&gt;&lt;/p&gt;
  
    &lt;ion-button expand="full" (click)="logout()"&gt;Deconnecte Toi&lt;/ion-button&gt;
  </code></pre>
  
  <p>but ts not working.
  thank you</p>