Any node in the scope can be outputted like this:
{{variable}}
could you output the entire scope somehow? something like
{{$scope}}
As a proof of concept, I created a directive to pretty-print the current scope.
You may use it anywhere, simply by adding <scope />
into the template.
Please note that this is just an idea and has several issues:
ngSanitize
to make ng-bind-html
work.prettyScope()
several times within an $apply()
so it may become sluggish when $scope
objects are large and/or have many chained updates (I guess).The out-of-this-world implementation of syntaxHighlight
is taken from here.
Full code and some scope inheritance and isolate scope cases on this plunker.
Sure.
$scope.scope = $scope
{{scope}}
Yet, just out of curiosity, why would you do that?
Edit
I didn't test this before answering. Mea culpa. This seems not to work, i get a string of "$SCOPE".
However, as mentioned in the comments, shouldn't console.dir()
do the job?