I have an issue with attribute directive.
I have defined following directive:
import {Directive, Input, ElementRef} from 'angular2/core';
@Directive({
selector: '[chooseMe]'
})
export class ChooseMe {
@Input('chooseMe') data: string;
constructor(private _elementRef:ElementRef) {
console.log(this.data);
}
}
And I hook it like that:
<button [chooseMe]="example"> W/E</button>
And of course, in my component I have:
@Component({
...,
directives:[ChooseMe]
})
However, each time this.data is undefined. Where is my mistake?