icon.ts (material2-7.3.2) | : | icon.ts (material2-7.3.3) | ||
---|---|---|---|---|
skipping to change at line 224 | skipping to change at line 224 | |||
const parts = iconName.split(':'); | const parts = iconName.split(':'); | |||
switch (parts.length) { | switch (parts.length) { | |||
case 1: return ['', parts[0]]; // Use default namespace. | case 1: return ['', parts[0]]; // Use default namespace. | |||
case 2: return <[string, string]>parts; | case 2: return <[string, string]>parts; | |||
default: throw Error(`Invalid icon name: "${iconName}"`); | default: throw Error(`Invalid icon name: "${iconName}"`); | |||
} | } | |||
} | } | |||
ngOnChanges(changes: SimpleChanges) { | ngOnChanges(changes: SimpleChanges) { | |||
// Only update the inline SVG icon if the inputs changed, to avoid unnecessa ry DOM operations. | // Only update the inline SVG icon if the inputs changed, to avoid unnecessa ry DOM operations. | |||
if (changes.svgIcon) { | if (changes['svgIcon']) { | |||
if (this.svgIcon) { | if (this.svgIcon) { | |||
const [namespace, iconName] = this._splitIconName(this.svgIcon); | const [namespace, iconName] = this._splitIconName(this.svgIcon); | |||
this._iconRegistry.getNamedSvgIcon(iconName, namespace).pipe(take(1)).su bscribe( | this._iconRegistry.getNamedSvgIcon(iconName, namespace).pipe(take(1)).su bscribe( | |||
svg => this._setSvgElement(svg), | svg => this._setSvgElement(svg), | |||
(err: Error) => console.log(`Error retrieving icon: ${err.message}`) | (err: Error) => console.log(`Error retrieving icon: ${err.message}`) | |||
); | ); | |||
} else { | } else { | |||
this._clearSvgElement(); | this._clearSvgElement(); | |||
} | } | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |