Renderer2

Renderer2

Experimental Class

Class Overview

class Renderer2 {
  data : {[key: string]: any}
  destroy() : void
  createElement(name: string, namespace?: string) : any
  createComment(value: string) : any
  createText(value: string) : any
  destroyNode : (node: any) => void |
  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) : void
  removeAttribute(el: any, name: string, namespace?: string) : 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
}

Class Description

Class Details

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) : any
createComment(value: string) : any
createText(value: string) : any
destroyNode : (node: any) => void |

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) : void
removeAttribute(el: any, name: string, namespace?: string) : 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

exported from core-index, defined in core/src/render/api.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/docs/ts/latest/api/core/index/Renderer2-class.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部