fix search routing

This commit is contained in:
Benedek László 2024-05-10 01:38:58 +02:00
parent a67e4a43e4
commit dfe4b1b00d
2 changed files with 3 additions and 3 deletions

View File

@ -4,7 +4,8 @@ import { SearchComponent } from './search.component';
const routes: Routes = [ const routes: Routes = [
{ path: ':query', component: SearchComponent } { path: ':query', component: SearchComponent },
{ path: '', component: SearchComponent }
]; ];
@NgModule({ @NgModule({

View File

@ -2,7 +2,6 @@ import { Component } from '@angular/core';
import { User } from '../../model/User'; import { User } from '../../model/User';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { UserService } from '../services/data/user.service'; import { UserService } from '../services/data/user.service';
import { SmallUserComponent } from '../shared/views/small-user/small-user.component';
@Component({ @Component({
selector: 'app-search', selector: 'app-search',
@ -14,7 +13,7 @@ export class SearchComponent {
users: Array<User> | undefined; users: Array<User> | undefined;
constructor(private route: ActivatedRoute, private userSvc: UserService) { 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 { ngOnInit(): void {