parent
ca3f9926f9
commit
3898dc488e
|
@ -67,7 +67,7 @@ export class NgStyle implements DoCheck {
|
||||||
|
|
||||||
private _setStyle(nameAndUnit: string, value: string): void {
|
private _setStyle(nameAndUnit: string, value: string): void {
|
||||||
const [name, unit] = nameAndUnit.split('.');
|
const [name, unit] = nameAndUnit.split('.');
|
||||||
value = value !== null && value !== void(0) && unit ? `${value}${unit}` : value;
|
value = value && unit ? `${value}${unit}` : value;
|
||||||
|
|
||||||
this._renderer.setElementStyle(this._ngEl.nativeElement, name, value);
|
this._renderer.setElementStyle(this._ngEl.nativeElement, name, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -213,7 +213,11 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
|
||||||
setStyle(element: any, styleName: string, styleValue: string) {
|
setStyle(element: any, styleName: string, styleValue: string) {
|
||||||
element.style[styleName] = styleValue;
|
element.style[styleName] = styleValue;
|
||||||
}
|
}
|
||||||
removeStyle(element: any, stylename: string) { element.style[stylename] = null; }
|
removeStyle(element: any, stylename: string) {
|
||||||
|
// IE requires '' instead of null
|
||||||
|
// see https://github.com/angular/angular/issues/7916
|
||||||
|
element.style[stylename] = '';
|
||||||
|
}
|
||||||
getStyle(element: any, stylename: string): string { return element.style[stylename]; }
|
getStyle(element: any, stylename: string): string { return element.style[stylename]; }
|
||||||
hasStyle(element: any, styleName: string, styleValue: string = null): boolean {
|
hasStyle(element: any, styleName: string, styleValue: string = null): boolean {
|
||||||
const value = this.getStyle(element, styleName) || '';
|
const value = this.getStyle(element, styleName) || '';
|
||||||
|
|
Loading…
Reference in New Issue