Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit, ViewEncapsulation } from '@angular/core';
- import { Observable } from 'rxjs/Rx'
- import { ProfileService } from '../../../global/services/profile/profile.service';
- import { Usuario } from '../../../global/interfaces/usuario.model';
- @Component({
- selector: 'app-topbar',
- templateUrl: './topbar.component.html',
- styleUrls: ['./topbar.component.css'],
- encapsulation: ViewEncapsulation.Emulated
- })
- export class TopbarComponent implements OnInit {
- idLogado;
- fotoLogado;
- data: any;
- constructor(private profileService: ProfileService) {
- this.idLogado = localStorage.getItem('id');
- this.fotoLogado = ('assets/imgs/blank-user.jpg');
- this.profileService.InitialiseProfile(this.idLogado);
- }
- ngOnInit() {
- console.log('=> SettibngsComponent');
- this.data = this.profileService.usuarioStream
- .subscribe(data => {
- this.data = data;
- this.fotoLogado = (data.perfil.foto || 'assets/img/blank-user.jpg');
- });
- }
- ngAfterViewInit() {
- console.log('=> TopbarComponent AfterInit');
- // console.log(JSON.stringify(this.data), null, 4);
- // console.log(this.data);
- Observable.interval(3000).flatMap(() => {
- return this.profileService.usuarioStream;
- }).subscribe((data) => {
- data = this.data = data;
- this.fotoLogado = (data.perfil.foto || 'assets/img/blank-user.jpg');
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement