I have a following tag:
<tag-input hideForm="true" [onRemoving]="onRemoving"></tag-input>
Where [onRemoving]="onRemoving" is function is called by attempts to delete value.
It looks like:
public onRemoving(tag: any): Observable<any> {
let del = '';
this.translate.get('confirmation_text').subscribe((res: string) => {
del = res['confirmation_text'];
});
}
Problem is in this code:
this.translate.get('confirmation_text').subscribe()...
I get an error:
TypeError: Cannot read property 'get' of undefined
I think cause is in area of visibility of this context
Constructor:
constructor(private translate: TranslateService) {
}
thisof class, it works only with local this oftag-input;this.translate.getthis.onRemoving = this.onRemoving.bind(this)