Skip to content

Commit

Permalink
🐛 fix search bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wellwind committed Mar 9, 2024
1 parent a930eb9 commit 7edc605
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/app/query/query.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import { MatCardModule } from '@angular/material/card';
import { MatListModule } from '@angular/material/list';
import { MatToolbarModule } from '@angular/material/toolbar';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { Observable, combineLatest, defer, filter, map, startWith, switchMap } from 'rxjs';
import {
Observable,
combineLatest,
defer,
filter,
map,
startWith,
switchMap,
} from 'rxjs';
import { SitePostService } from '../site-common/site-post.service';

@Component({
Expand All @@ -25,7 +33,7 @@ import { SitePostService } from '../site-common/site-post.service';
<mat-card appearance="outlined">
<mat-card-content>
<h2>共 {{ searchResult.length }} 篇文章</h2>
<h2>共 {{ searchResult().length }} 篇文章</h2>
@if (searchDateStart()) {
<span class="search-chip">
Expand Down Expand Up @@ -106,7 +114,7 @@ export class QueryComponent {
private route = inject(ActivatedRoute);

private searchKeyword$ = this.route.queryParamMap.pipe(
map((queryParamMap) => `${queryParamMap.get('q')}`),
map((queryParamMap) => queryParamMap.get('q')),
filter(Boolean),
startWith('')
);
Expand Down

0 comments on commit 7edc605

Please sign in to comment.