Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import { Router } from '@angular/router';
- import { AuthService } from '../core/services/auth.service'
- import { CurrentUserService } from '../core/services/current-user.service';
- import { CurrentUser } from '../core/models/current-user.model';
- @Component({
- selector: 'app-home',
- templateUrl: './home.component.html'
- })
- export class HomeComponent implements OnInit {
- currentUser: CurrentUser = new CurrentUser();
- constructor(
- private authService: AuthService,
- private router: Router,
- private currentUserService: CurrentUserService) {
- }
- ngOnInit() {
- let self = this;
- this.currentUserService.loadData().subscribe(
- ( data ) => {
- self.currentUserService.set(data);
- self.currentUser = self.currentUserService.get();
- },
- ( error ) => { alert('error: ' + error) }
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement