Why not just do this in the controller:
app.controller('MyCtrl', function($scope) {
$scope.var1 = "this is var1";
$scope.var2 = "this is var2";
this.scope = $scope;
});.
So that we can do the following in the template:
<div ng-controller="MyCtrl as my">
<div>
{{my.scope.var1}}
</div>
<div ng-controller="OtherCtrl as other">
{{my.scope.var1}}
{{other.scope.someVar}}
</div>
</div>
This would give us the benefits from both sides:
1. Use alias'ing in view (for nested controllers)
2. Actually work on the $scope-object (we still have $apply, $watch etc
and dont have to change testing)
The only catch that I can see so far is that I have to write the scope
variable everytime, which is a bit ugly.
What do you think about that? Does this break something that I dont know
of? (Im still a angular novice)
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.