Files
Adam Bradley 504ab46eb3 update to alpha.28)
domElement renamed to nativeElement
2015-06-27 12:12:16 -05:00

27 lines
530 B
JavaScript

import {Directive, onInit} from 'angular2/src/core/annotations_impl/annotations';
import {ElementRef} from 'angular2/src/core/compiler/element_ref';
@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;
}
}
}