import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { User } from 'src/app/models/user'; import { UserService } from 'src/app/services/user.service'; @Component({ selector: 'app-user-profile-details', templateUrl: './user-profile-details.component.html', styleUrls: ['./user-profile-details.component.css'] }) export class UserProfileDetailsComponent implements OnInit { currentUser : Observable; user : User; constructor(private _userService : UserService) { this.currentUser = this._userService.searchUser(100); this.currentUser.subscribe((user: User) => {this.user = user}); // this.user = this._userService.currentUser; } public editUserName() { alert("editUserName pressed !"); } public editEmail() { alert("editEmail pressed !"); } public editPassword() { alert("editPassword pressed !"); } public editPhone() { alert("editPhone pressed !"); } ngOnInit(): void { this.user = this._userService.currentUser; } }