when publishing and subscribing events using $emit, $broadcast, or $on consider moving these uses to a factory and invoke from the controller.
is there an example?
if you need the $scope methods, you need to inject $scope.
So is it ok to use this and $scope in one controller?
You can certainly do that. Part of the advantage of using "controller as" is that the $scope does many things. Controller As allows the data binding aspects to remain separate and then we only inject $scope when we need it for something else.
When I need $scope for something in a controller, I try to first see if I really need it, and if I do I abstract it to a service for tings like broadcast/emit. So in your case I would still abstract it.
Clear! Thanks a lot!
Most helpful comment
You can certainly do that. Part of the advantage of using "controller as" is that the $scope does many things. Controller As allows the data binding aspects to remain separate and then we only inject $scope when we need it for something else.
When I need $scope for something in a controller, I try to first see if I really need it, and if I do I abstract it to a service for tings like broadcast/emit. So in your case I would still abstract it.