Imo
Imo

Reputation: 1475

How to add a variable chained to $scope in a function

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

Answers (1)

NeoAsh
NeoAsh

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

Related Questions