Skip to main content

Recent Searches

The RecentSearches feature provides a UI and logic for displaying and managing a user's recent search queries. It helps users quickly revisit previous searches and improves search experience.

Usage

sample.component.ts
import { RecentSearchesComponent } from "@angular/atomic-angular";

@Component({
selector: "sample-component",
imports: [RecentSearchesComponent],
template: `
<recent-searches />
`,
})
export class SampleComponent {
// The component automatically loads and displays recent searches
}

Properties

PropertyTypeDescription
recentSearchesObservable<SearchQuery[]>List of recent search queries
loadingbooleanWhether recent searches are being loaded
errorstring | nullError message if loading fails

Methods

MethodDescription
selectSearch(query)Re-executes a previous search
clearRecent()Clears all recent searches

Features

  • Displays a list of recent search queries
  • Allows re-executing or removing individual searches
  • Option to clear all recent searches
  • Integrates with search and navigation services

Visual Schema

Notes

  • Recent searches are typically stored locally for privacy and speed.
  • The component can be used in search bars, dropdowns, or as a standalone list.