From dfe4b1b00df636188ddc56dc3da72f1fe4759f4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benedek=20L=C3=A1szl=C3=B3?= Date: Fri, 10 May 2024 01:38:58 +0200 Subject: [PATCH] fix search routing --- src/app/search/search-routing.module.ts | 3 ++- src/app/search/search.component.ts | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/app/search/search-routing.module.ts b/src/app/search/search-routing.module.ts index d7b9b51..a313045 100644 --- a/src/app/search/search-routing.module.ts +++ b/src/app/search/search-routing.module.ts @@ -4,7 +4,8 @@ import { SearchComponent } from './search.component'; const routes: Routes = [ - { path: ':query', component: SearchComponent } + { path: ':query', component: SearchComponent }, + { path: '', component: SearchComponent } ]; @NgModule({ diff --git a/src/app/search/search.component.ts b/src/app/search/search.component.ts index c6d46da..45776b1 100644 --- a/src/app/search/search.component.ts +++ b/src/app/search/search.component.ts @@ -2,7 +2,6 @@ import { Component } from '@angular/core'; import { User } from '../../model/User'; import { ActivatedRoute } from '@angular/router'; import { UserService } from '../services/data/user.service'; -import { SmallUserComponent } from '../shared/views/small-user/small-user.component'; @Component({ selector: 'app-search', @@ -14,7 +13,7 @@ export class SearchComponent { users: Array | undefined; constructor(private route: ActivatedRoute, private userSvc: UserService) { - this.route.params.subscribe(params => { this.query = params['query'] }); + this.route.params.subscribe(params => { this.query = params['query'] ? params['query'] : "" }); } ngOnInit(): void {