Skip to main content

Selection Service

Overview

The SelectionService is responsible for managing the current article selection and updating the query parameters accordingly.

setCurrentArticle()

Sets the current article in the selection store and optionally updates the query text. If the provided article is undefined, it clears the current article.

public setCurrentArticle(article?: Article, withQueryText: boolean = true): void
ParameterTypeDescription
articleArticleOptional. The article to set as the current article. If undefined, the current article is cleared.
withQueryTextbooleanA boolean indicating whether to update the query text in the selection store. Defaults to true.

Usage Example:

const article: Article = { id: '123', title: 'Sample Article' };
selectionService.setCurrentArticle(article);

clearCurrentArticle()

Clears the current article selection from the selection store and removes the article ID from the query parameters.

public clearCurrentArticle(): void

Usage Example:

selectionService.clearCurrentArticle();