本文整理匯總了TypeScript中angular2/core.Renderer.setElementStyle方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Renderer.setElementStyle方法的具體用法?TypeScript Renderer.setElementStyle怎麽用?TypeScript Renderer.setElementStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/core.Renderer
的用法示例。
在下文中一共展示了Renderer.setElementStyle方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(private el: ElementRef, private window: Window, private renderer: Renderer) {
let height = window.innerHeight + 'px';
let native = el.nativeElement;
renderer.setElementStyle(native, 'height', height);
renderer.setElementStyle(native, 'maxHeight', height);
renderer.setElementStyle(native, 'width', height);
renderer.setElementStyle(native, 'maxWidth', height);
}
示例2: _fullScreenOff
_fullScreenOff() {
// this._renderer.setElementClass(this._el, '', false);
// this._renderer.setElementStyle(this._el, 'position', 'static');
this._renderer.setElementStyle(this._el, 'width', `480px`);
this._renderer.setElementStyle(this._el, 'height', `320px`);
}
示例3: constructor
constructor(element: ElementRef, renderer: Renderer) {
// simple DOM manipulation to set font size to x-large
// `nativeElement` is the direct reference to the DOM element
// element.nativeElement.style.fontSize = 'x-large';
// for server/webworker support use the renderer
renderer.setElementStyle(element.nativeElement, 'fontSize', 'x-large');
renderer.setElementStyle(element.nativeElement, 'color', 'red');
renderer.setElementStyle(element.nativeElement, 'font-weight', 'bold');
}
示例4: onFocus
onFocus()
{
this._renderer.setElementStyle(
this._el.nativeElement,
'width',
'200' );
}
示例5: onBlur
onBlur()
{
this._renderer.setElementStyle(
this._el.nativeElement,
'width',
'120' );
}
示例6: createChild
createChild() {
if(this.element === null)
this.element = this.renderer.selectRootElement('.dynamic-container');
console.log('selected element: ', this.element);
this.element = this.renderer.createElement(this.element, 'div'); //this will replace all content of element
this.renderer.setElementStyle(this.element, 'padding-left', '15px');
this.renderer.createText(this.element, 'created by renderer');
}
示例7: _setStyle
private _setStyle(name: string, val: string): void {
this._renderer.setElementStyle(this._ngEl.nativeElement, name, val);
}
示例8: onFocus
onFocus(){
this.ren.setElementStyle(this.el.nativeElement,'width','200');
}
示例9: constructor
constructor(el: ElementRef, renderer: Renderer) {
// el.nativeElement.style.color = 'red';
renderer.setElementStyle(el.nativeElement, 'color', 'red');
}
示例10: highlight
private highlight(color: string){
this._renderer.setElementStyle(this._elRef, 'background-color', color);
}