So for my sins I'm on an Angular 2 project. I use angular.element($0).scope()
all the time on my old Angular 1 work to inspect an element and see what's on the scope at that point in the dev tools. This is super useful, is there something similar in Angular 2?
In Angular 2, controllers and scope no longer exist, with applications required to follow the component architecture, which makes components the logical place to start when discussing the changes between the two versions.
The controllers and $scope in Angular 1 have been replaced with “Components” in Angular 2. Hence we can say that it is a component-based framework, which uses zone.
In Angular 2.0, there will be no $scope .
What is alternative of rootScope in Angular? In similar way, you can use use the sharedService inside any component & fetch the returing output and used inside your view. That's it. I found this solution as a good alternative of rootScope.
Augury is a great suggestion. If you want direct access use
ng.probe($0)
See also
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