Angular Accessing Scope from Outside
HTML
<script type="text/javascript" ng:autobind
src="http://code.angularjs.org/0.9.16/angular-0.9.16.js"></script>
<div id="parent" ng:controller="ParentCntl">
This is {{name}}.
<div id="child" ng:controller="ChildCntl">
This is {{name}}.
</div>
</div>
CSS
div {
padding: 5px;
margin: 5px;
border: 1px solid gray;
}
JavaScript
function ParentCntl() {
this.name = 'prent';
}
function ChildCntl() {
this.name = 'child';
}
window.addEventListener('load', function() {
console.log(angular.element(document.getElementById('parent')).scope().name);
console.log(angular.element(document.getElementById('child')).scope().name);
// when using jQuery, you can do just $('#child').scope()
});