import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { UserService } from '../../services/user.service'; @Component({ standalone: false, selector: 'page-user', templateUrl: './user.page.html', styleUrls: ['./user.page.scss'] }) export class PageUser implements OnInit { notfound: boolean = false; username: string; user: any; constructor(private userService: UserService, private route: ActivatedRoute) { } ngOnInit(): void { this.username = this.route.snapshot.paramMap.get('username'); this.userService.getUser(this.username).subscribe({ next: (data) => { this.user = data; }, error: (error) => { if (error.status == 422) { this.notfound = true; } } }) } }