On this page
Renderer2
class
| npm Package | @angular/core | 
|---|---|
| Module | import { Renderer2 } from '@angular/core'; | 
     
| Source | core/src/render/api.ts | 
Overview
class Renderer2 {
  get data: {...}
  destroy(): void
  createElement(name: string, namespace?: string | null): any
  createComment(value: string): any
  createText(value: string): any
  destroyNode: ((node: any) => void) | null
  appendChild(parent: any, newChild: any): void
  insertBefore(parent: any, newChild: any, refChild: any): void
  removeChild(parent: any, oldChild: any): void
  selectRootElement(selectorOrNode: string | any): any
  parentNode(node: any): any
  nextSibling(node: any): any
  setAttribute(el: any, name: string, value: string, namespace?: string | null): void
  removeAttribute(el: any, name: string, namespace?: string | null): void
  addClass(el: any, name: string): void
  removeClass(el: any, name: string): void
  setStyle(el: any, style: string, value: any, flags?: RendererStyleFlags2): void
  removeStyle(el: any, style: string, flags?: RendererStyleFlags2): void
  setProperty(el: any, name: string, value: any): void
  setValue(node: any, value: string): void
  listen(target: 'window' | 'document' | 'body' | any, eventName: string, callback: (event: any) => boolean | void): () => void
}
  Members
get data: { [key: string]: any; }
  This field can be used to store arbitrary data on this renderer instance. This is useful for renderers that delegate to other renderers.
destroy(): void
  createElement(name: string, namespace?: string | null): any
  createComment(value: string): any
  createText(value: string): any
  destroyNode: ((node: any) => void) | null
  This property is allowed to be null / undefined, in which case the view engine won't call it. This is used as a performance optimization for production mode.
appendChild(parent: any, newChild: any): void
  insertBefore(parent: any, newChild: any, refChild: any): void
  removeChild(parent: any, oldChild: any): void
  selectRootElement(selectorOrNode: string | any): any
  parentNode(node: any): any
  Attention: On WebWorkers, this will always return a value, as we are asking for a result synchronously. I.e. the caller can't rely on checking whether this is null or not.
nextSibling(node: any): any
  Attention: On WebWorkers, this will always return a value, as we are asking for a result synchronously. I.e. the caller can't rely on checking whether this is null or not.
setAttribute(el: any, name: string, value: string, namespace?: string | null): void
  removeAttribute(el: any, name: string, namespace?: string | null): void
  addClass(el: any, name: string): void
  removeClass(el: any, name: string): void
  setStyle(el: any, style: string, value: any, flags?: RendererStyleFlags2): void
  removeStyle(el: any, style: string, flags?: RendererStyleFlags2): void
  setProperty(el: any, name: string, value: any): void
  setValue(node: any, value: string): void
  listen(target: 'window' | 'document' | 'body' | any, eventName: string, callback: (event: any) => boolean | void): () => void
  © 2010–2018 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
 https://v5.angular.io/api/core/Renderer2