🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

ngx-html-highlighter

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-html-highlighter

A full page html text highlighter for Angular

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

Angular Html Highlighter

Highlight strings of text across the entire page, regardless of application, library or component boundaries.

Usage

  • Install the library in your package.json for example using npm i --save ngx-html-highlighter.
  • Add the NgxHtmlHighlighterModule.forRoot() to your module's imports section. The forRoot is necessary for the service to be available (see next item).
  • Inject the HighlighterService in your module or component.
  • Call createHighlighter with an optional options argument to create a highlighter object. The highlighter begins its work immediately.
  • Important: When no longer needed call destroy on the highlighter object or alteratively pass the highlighter to the service's destroyHighlighter method.

Options

export interface Options {
  tagAttribute: string;
  highlightClass: string;
}
  • tagAttribute is the attribute name used to "tag" a node as having been inserted by the highlighter.
  • highlightClass is the class added to the highlighted spans. You should add styles to this class in your global stylesheets (e.g. src/app/styles.css in a default angular app)

Keywords

angular

FAQs

Package last updated on 26 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts