I'm trying to bind a function (this.getData) to a variable (rating) within the constructor of a directive:
@NgDirective(
selector: '[spreadsheet]',
map: const {
'rating' : '<=>rating'
})
class Spreadsheet {
dom.Element element;
Function rating;
getData(){
return context.callMethod(r'$', [this.element])
.callMethod('handsontable', ['getData']);
}
Spreadsheet(this.element) {
context.callMethod(r'$', [this.element])
.callMethod('handsontable', [new JsObject.jsify(options)]);
**rating = this.getData;**
}
}
and it seems that "rating" is not assigned with "this.getData" when I access it:
<p spreadsheet rating="rating"></p>
{{rating()}}
the "rating" is null. This is not the case when I do the binding for example when mouse enters the element:
...
Spreadsheet(this.element) {
element
..onMouseEnter.listen((ev){this.rating = this.getData;});
...
and the binding occurs fine when mouse enters the element (rating is not null). How this can be fixed?