1

I know I can enable $compileProvider to see debug info, but in my case, I prefer not to enable it.

When I use angular.element($0).scope(); or $($0).data().$scope it is returning undefined. I wonder if there is any solution that doesn't need to turn on debug info to get $scope with jQuery.

1

2 Answers 2

1

First you need to select the element from developer mode then go with console in browser.: Before this it must be ensure that your angularjs library loaded.

angular.element($0).scope()
Sign up to request clarification or add additional context in comments.

Comments

0

$0 is a reference to the select element of the DOM. You probably gets undefined because you didn't select an element of the DOM before asking for its scope.

There is two ways to do it:

  • Right click + inspect an element, then run angular.element($0).scope();
  • Get the element from its ID directly in the console: angular.element(document.getElementById('elementId')).scope();

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.