fix search routing
This commit is contained in:
parent
a67e4a43e4
commit
dfe4b1b00d
@ -4,7 +4,8 @@ import { SearchComponent } from './search.component';
|
||||
|
||||
|
||||
const routes: Routes = [
|
||||
{ path: ':query', component: SearchComponent }
|
||||
{ path: ':query', component: SearchComponent },
|
||||
{ path: '', component: SearchComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
@ -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<User> | 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user