Access angular scope outside
HTML
<div ng-app>
<div id="outer" ng-controller="MsgCtrl">
You are {{msg}}
</div>
<div onclick="change()">click me</div>
</div>
JavaScript
function MsgCtrl($scope)
{
$scope.msg = "great";
}
function accessScope(node, func) {
var scope = angular.element(document.querySelector(node)).scope();
scope.$apply(func);
}
function change()
{
alert("a");
accessScope('MsgCtrl', function (scope) {
scope.msg = 'Superhero';
});
}