You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
TypeError: vm.$broadcast is not a function
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?
The text was updated successfully, but these errors were encountered: