Here's a snippet of a controller I am working with:
function controller($scope)
{
this.helper() = function()
{
// some processing
};
$scope.doSomething = function()
{
helper();
};
}
Running into an issue where calling doSomething results in an error stating that helper() is not defined. Even trying to use 'this' before helper() doesn't work as it points to $scope instead of the controller instance.
My query is: Is there a way to access these internal helper functions from within a scope function? (I understand placing helper() on $scope could solve the problem, but prefer not to as it's purely for convenience, not meant for views.)
The structure I'm using aims to enable separate testing of the helper() function during unit tests.