Skip to main content
Version: 11.14.0

Selection History

The SelectionHistoryService maintains a navigable history of selected articles. It is used internally by the DrawerComponent.

Methods

getCurrentSelectionIndex()

Returns the index of the current (most recent) selection in the history.

getCurrentSelectionIndex(): number

Returns number — the index of the current selection.

Example

import { inject } from '@angular/core';
import { SelectionHistoryService } from '@sinequa/atomic-angular';

const index = inject(SelectionHistoryService).getCurrentSelectionIndex();

getSelection()

Retrieves an article from the history at the specified index.

getSelection(index: number): Article | undefined
NameTypeRequiredDescription
indexnumberThe index of the article to retrieve.

Returns Article | undefined — the article at that index, or undefined if out of bounds.

Example

const article = inject(SelectionHistoryService).getSelection(0);

getHistoryLength()

Returns the number of entries in the history.

getHistoryLength(): number

Returns number — the history length.

Example

const length = inject(SelectionHistoryService).getHistoryLength();

clearHistory()

Clears the selection history and resets the current article selection.

clearHistory(): void

Example

inject(SelectionHistoryService).clearHistory();

back()

Navigates back in the selection history.

back(): Article | undefined

Returns Article | undefined — the previous article, or undefined if the history is empty.

Example

const previous = inject(SelectionHistoryService).back();