ish*_*hwr 9 javascript jquery angularjs
stackoverflow中有几个这样的问题.我知道.尝试了所有的答案,但仍然没有运气.我的HTML:
<div class="headline" id="headline-game">
{{gameContent.headline}}
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery的:
var country = $("#headline-game").scope().headline;
alert(country);
Run Code Online (Sandbox Code Playgroud)
但我没有定义,而不是我的范围.谁能帮我?我不想改变范围,只是访问它.
hjg*_*aca 12
Angular会angular
向窗口添加一个全局变量.
所以你可以这样做:
angular.element("#headline-game").scope().gameContent.headline;
Run Code Online (Sandbox Code Playgroud)
尝试这个
var country = $("#headline-game").scope().gameContent.headline;
alert(country);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
26685 次 |
最近记录: |