The situation: I recently started using Typescript and am currently integrating it into my AngularJS web application. I have been using the 'controller as' syntax instead of $scope where possible.
The issue: I can't seem to find a proper way to replace var self = this;
I started replacing vm with this everywhere which soon got me to a dead-end when inside of forEach functions, click events etc.
My temporary solution: casting var self = this; in each function, since I can't cast it globally as far as I understand. It also doesn't work in all cases.
My question: have I missed something obvious? Is there a better way to access the controller's scope?