Skip to main content
This example demonstrates a standalone Angular application using the Quran Search Engine library.

Features

  • Standalone Angular component (no NgModule required)
  • Reactive search with debouncing
  • Lemma, root, and fuzzy search options
  • Highlighted results by match type
  • Pagination controls
  • Type-safe implementation

Setup

1

Install dependencies

2

Start the development server

From the workspace root:
Or from the example directory:
Angular uses start instead of dev for the development server.
3

Open your browser

Navigate to http://localhost:4200

Project structure

Component implementation

The example uses a standalone component with inline template and styles:
app.component.ts
This example uses Angular 18+ standalone components, eliminating the need for NgModule declarations.

Loading data on initialization

Load all datasets when the component initializes:
app.component.ts

Search with debouncing

Implement debounced search triggered by input changes:
app.component.ts

Template with search controls

Create a reactive search interface:
app.component.ts (template)

Highlighting implementation

Implement highlight rendering with caching for performance:
app.component.ts
The example caches highlight parts by verse gid to avoid recalculating them on every change detection cycle.

Display results with highlighting

Render highlighted verses in the template:
app.component.ts (template)

Pagination controls

Implement page navigation:
app.component.ts
app.component.ts (template)

Dependencies

The example uses these key dependencies:
package.json

Key features demonstrated

  • Standalone components: Modern Angular architecture without NgModules
  • Two-way binding: Using [(ngModel)] for reactive forms
  • Async operations: Proper async/await handling in lifecycle hooks
  • Performance optimization: Highlight caching and trackBy for efficient rendering
  • Accessibility: ARIA labels and semantic HTML
  • Type safety: Full TypeScript integration with Angular