当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - 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;

}

网友答案:

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 to access the $scope variable in browser's console using AngularJS?

分享给朋友:
您可能感兴趣的文章:
随机阅读: