Files
2015-07-03 13:19:30 -05:00

26 lines
446 B
TypeScript

import {Directive, onInit, ElementRef} from 'angular2/angular2';
@Directive({
selector: 'icon',
properties: [
'name'
],
host: {
'[attr.aria-label]': 'label',
'role': 'img'
},
lifecycle: [onInit]
})
export class Icon {
constructor(elementRef: ElementRef) {
this.ele = elementRef.nativeElement;
}
onInit() {
if (this.name) {
this.ele.classList.add(this.name);
this.label = this.name;
}
}
}