Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import {Component, OnInit} from '@angular/core';
  2. import {AppService} from '../../_app/app.service';
  3. import {App, User} from '../../../api';
  4. import {Observable, Observer} from 'rxjs';
  5. import {AuthService} from '../../_auth/auth.service';
  6. import {Input} from '@angular/core';
  7. import {tap} from 'rxjs/internal/operators';
  8.  
  9. @Component({
  10.     selector: 'app-header',
  11.     templateUrl: './header.component.html',
  12.     styleUrls: ['./header.component.scss'],
  13. })
  14. export class HeaderComponent implements OnInit {
  15.     public user$: User;
  16.  
  17.     constructor(public authService: AuthService, public  appService: AppService) {
  18.  
  19.         this.user$ = this.authService.currentUser.pipe(tap(user => this.user$ = user));
  20.  
  21.     }
  22.  
  23.  
  24.     ngOnInit() {
  25.         alert(this.user$.firstName);
  26.  
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement