Class ThemeStyleManagerServiceInternal

A service that manages the activation and deactivation of themes.

The service uses the ContentObserver service to observe changes in the <head> element and updates the internal theme registry when new <style> elements are added to the DOM.

Themes are identified by the data-theme attribute on the <style> element.

The service provides a method use to activate a theme with a given ID and deactivate all other themes.

Constructors

Properties

document: Document

A reference to the current document

observer: ContentObserver

The Angular ContentObserver service

themeRegistry: ThemeRegistryService

A service to register new themes

Methods

  • Private

    Updates the internal theme registry.

    Identifies all <style> elements without the data-no-theme and data-theme attributes. Extracts the theme annotations from the elements' text content and applies the data-theme or data-no-theme attribute depending on the discovered theme id.

    Returns void

    See

    • extractThemeAnnotations
    • applyThemeIdentifier
  • Activates the theme with the given ID and deactivates all other themes.

    Parameters

    • theme: string

      The theme to activate

    Returns void

    See

    • turnOn
    • turnOff

    Remarks

    A theme may consist of 1 or more <style> elements.