本文整理匯總了TypeScript中@angular/core.Renderer類的典型用法代碼示例。如果您正苦於以下問題:TypeScript Renderer類的具體用法?TypeScript Renderer怎麽用?TypeScript Renderer使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Renderer類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(el: ElementRef, renderer: Renderer) {
renderer.setElementStyle(el.nativeElement, 'backgroundColor', 'yellow');
renderer.setElementStyle(el.nativeElement, 'font-size', '2em');
}
示例2: constructor
constructor(renderer: Renderer, el: ElementRef) {
renderer.setElementStyle(el.nativeElement, 'backgroundColor', 'gold');
console.log(
`* AppRoot highlight called for ${el.nativeElement.tagName}`);
}
示例3: alignToElement
/**
* Calculates the styles from the provided element in order to align the ink-bar to that element.
* @param element
*/
alignToElement(element: HTMLElement) {
this._renderer.setElementStyle(this._elementRef.nativeElement, 'left',
this._getLeftPosition(element));
this._renderer.setElementStyle(this._elementRef.nativeElement, 'width',
this._getElementWidth(element));
}
示例4: onBlur
onBlur() {
this.renderer.setElementStyle(this.el.nativeElement, 'width', '120');
}
示例5: show
/** Shows the ink bar. */
show(): void {
this._renderer.setElementStyle(this._elementRef.nativeElement, 'visibility', 'visible');
}
示例6:
this.d.cssClass.split(' ').forEach(cssClass => {
// Make sure the class isn't whitespace, otherwise it throws exceptions
if (cssClass.trim() !== '') _renderer.setElementClass(_elementRef.nativeElement, cssClass, true);
});
示例7: onFocus
public onFocus() : void {
this.renderer.setElementStyle(this.el.nativeElement, 'width', '400px');
}
示例8: focus
focus(): void {
this._renderer.invokeElementMethod(this._elementRef.nativeElement, 'focus');
}
示例9:
_setCssClass(componentRef: any, className: string) {
this._renderer.setElementClass(componentRef.location.nativeElement, className, true);
}
示例10: setElementAttribute
/** @private */
setElementAttribute(attributeName: string, attributeValue: any) {
this._renderer.setElementAttribute(this._elementRef.nativeElement, attributeName, attributeValue);
}