Skip to content

Instantly share code, notes, and snippets.

@iladarsda
Last active August 29, 2015 14:02
Show Gist options
  • Save iladarsda/6b109491b70bce9e4ebc to your computer and use it in GitHub Desktop.
Save iladarsda/6b109491b70bce9e4ebc to your computer and use it in GitHub Desktop.
Invoke $scope function from the browser console
angular.element($0).scope().someFunction();
// #someID could be any other element within same controller, i.e. same scope
angular.element(document.querySelector('#someID')).scope().someFunction();
<div id="someID" ng-controller="MainCtrl">
// some stuff here
</div>
function MainCtrl($scope) {
$scope.someFunction = function() {
console.log("someFunction..");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment