Reputation: 1475
Suppose we have a variable defined as
$scope.name = 'myName'
how can I return it from a function within JavaScript like so
function returnVar(){
alert 'this is the variable in Scope': name;
}
Upvotes: 0
Views: 30
Reputation: 1333
See Below link for your solution:
https://coderwall.com/p/smkwhg/access-scope-outside-of-angularjs
Also Stackoverflow link which have same type of discussion: How do I access the $scope variable in browser's console using AngularJS?
Upvotes: 3