I have created an angular application where my views are loading in ng-view tag based on the route configuration. In once of my view I am loading sub templates using ng-include based on a dropdown selection dynamically. On button click action on the main view I want to get the scope of the view which is loaded in ng-include. Can anybody suggest me how to do it ?
You could do something like this to access a particular controller scope.
var ctrlElement = document.querySelector('div'); var ctrlScope = angular.element(ctrlElement).scope(); console.log(ctrlScope.user);
Below is a simple fiddle showing it.