Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## AuthService
- private currentUser: Subject<ApplicationUser>;
- user$: Observable<ApplicationUser>;
- constructor(private http: HttpClient, private router: Router) {
- this.currentUser = new Subject();
- this.user$ = this.currentUser.asObservable();
- }
- getCurrentUserInfo() {
- this.currentUser.next(new ApplicationUser('asd', 'asd'));
- }
- ## Component
- currentUser: ApplicationUser;
- ngOnInit() {
- this.authService.checkAccess();
- this.authService.user$.subscribe((userData) => { this.currentUser = userData; });
- }
- ## Widok
- <a>{{(currentUser)?.Email}}</a>
Advertisement
Add Comment
Please, Sign In to add comment