I have implemented angular's 'controller as somename' syntax.
Consider the following function as my controller:
function myCOntroller($scope)
{
$scope.$emit('event');
}
The above function is functioning properly. I attempted the following approach:
function myController()
{
var reference = this;
reference.$emit('event');
}
This method did not work. I am able to use reference for data bindings, so why can't I use it for such tasks? I assumed that since reference now contains all the functions that $scope has, $emit would work in this way too.
NOTE: Apologies for the code samples being purely theoretical. This question was posed as a proof of concept without any actual code involved.