本文整理汇总了TypeScript中angular2/core.Renderer.setElementAttribute方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Renderer.setElementAttribute方法的具体用法?TypeScript Renderer.setElementAttribute怎么用?TypeScript Renderer.setElementAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/core.Renderer
的用法示例。
在下文中一共展示了Renderer.setElementAttribute方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngAfterViewInit
ngAfterViewInit() {
var canvas: any = this.cropcanvas.nativeElement;
if (!this.settings) {
this.settings = new CropperSettings();
}
this.renderer.setElementAttribute(canvas, 'width', this.settings.canvasWidth.toString());
this.renderer.setElementAttribute(canvas, 'height', this.settings.canvasHeight.toString());
this.cropper = new ImageCropper(canvas, 0, 0,
this.settings.width, this.settings.height,
this.settings.croppedWidth, this.settings.croppedHeight);
}
示例2: constructor
constructor(
public platform: Platform,
public elementRef: ElementRef,
public renderer: Renderer) {
this.isAndroid = platform.is('android');
renderer.setElementAttribute(elementRef.nativeElement, 'primary', this.isAndroid ? '' : null);
}
示例3: ngOnInit
ngOnInit() {
let w: any;
let h: any;
if (this.dimensions) {
let d = this.dimensions.split('x');
w = d[0];
h = d[1];
} else if (this.width && this.height) {
w = this.width;
h = this.height;
} else {
this.error();
}
if (w && h) {
this.renderer.setElementAttribute(this.el.nativeElement, 'src', this.pusherGifService.createGif(w, h));
}
}
示例4: onBlur
onBlur(){
this.renderer.setElementAttribute(this.el.nativeElement, 'width', '120');
}
示例5: ngAfterViewInit
ngAfterViewInit() {
this._renderer.setElementAttribute(this.el.nativeElement, "newAtt", "");
}
示例6: onBlur
onBlur(){
this.renderer.setElementAttribute(this.el,'width','120')
}
示例7: onFocus
onFocus(){
this.renderer.setElementAttribute(this.el,'width','200')
}
示例8:
Object.keys(attrs).forEach((key) => {
this.renderer.setElementAttribute(this.element.nativeElement, key, attrs[key]);
});
示例9: constructor
constructor(private el: ElementRef, private renderer: Renderer) {
renderer.setElementAttribute(el.nativeElement, 'class', 'sample-class');
}