Cookie, Copy, DOM etc

CookieService

A set of simple Cookie manipulation classes.

  • cookie Original cookie value

  • getAll Get all cookie key-value pairs

  • get Get the value of given cookie key

  • put Sets a value for given cookie key

isEmpty

Used to verify <ng-content> is empty, useful for custom components.

updateHostClass

Update host component style class, for example:

updateHostClass(
  this.el.nativeElement,
  this.renderer,
  {
    [ 'classname' ]: true,
    [ 'classname' ]: this.type === '1',
    [ this.cls ]: true,
    [ `a-${this.cls}` ]: true
  }
)

copy

Copy text to clipboard.

ScrollService

Scrollbar control allows scrolling to where the specified element.

MethodPropertyDescription
getScrollPositionelement?: ElementRetrieves the current scroll position
scrollToPositionelement: Element | Window, position: [number, number]Sets the scroll position
scrollToElementelement?: Element, topOffset = 0Scroll to element
scrollToToptopOffset = 0Scroll to top