Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an Angular 2 equivalent for 'angular.element($0).scope()'

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?

like image 926
SpaceBeers Avatar asked Jun 16 '16 07:06

SpaceBeers


People also ask

Does Angular 2 have scope?

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.

What is the replacement of the controller and scope in Angular 2?

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.

Is $scope still supported in angular 2+?

In Angular 2.0, there will be no $scope .

What is alternative of rootScope in angular?

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.


1 Answers

Augury is a great suggestion. If you want direct access use

ng.probe($0)

See also

  • Get ComponentRef from DOM element
  • How to access the *angular 2* components' data in the browser's console?
  • how to access Angular2 component specific data in console?
like image 107
Günter Zöchbauer Avatar answered Nov 14 '22 22:11

Günter Zöchbauer