Without getting into the details of why, I need to provide an alias for $scope
in my controllers. Instead of injecting and decorating $scope
I'd like for the users to instead be able to inject view
and have it have the same effect.
Based on my understanding of angular, $scope
is created by a $scopeProvider
which is a factory registered at configuration time of the angular app. I'm assuming that I need to register a viewProvider
and set it equal to the $scopeProvider
but I haven't had luck with what I've been trying. Any ideas?
FYI: I'm not looking for something like ['$scope', function(view){...
, the ideal solution would work with ['view', function(view){...
. The view object would act exactly like $scope
, two way binding, etc.
If you are teaching AngularJS
, you should actually avoid using $scope
and use controller as syntax
-- See this awesome Angular Style Guide by John Papa for explanation.
That would also solve your problem :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With