import { Component , OnInit , Input , AfterViewInit , ElementRef , HostBinding } from '@angular/core' ; import { icons } from './icons' ; @ Component ( { selector : 'gantt-icon' , template : '' } ) export class GanttIconComponent implements OnInit , AfterViewInit { @ HostBinding ( 'class.gantt-icon' ) isIcon = true ; @ Input ( ) set iconName ( name ) { this . setSvg ( name ) ; } constructor ( private elementRef ) { } ngOnInit ( ) { } ngAfterViewInit ( ) { } setSvg ( name ) { const iconSvg = icons [ name ] ; if ( iconSvg ) { this . elementRef . nativeElement . innerHTML = iconSvg ; } else { this . elementRef . nativeElement . innerHTML = '' ; } } }