在AngularJS模板中显示范围变量

时间:2014-04-09 20:59:06

标签: angularjs templates variables scope

我遇到了一个非常奇怪的情况,试图在angularjs模板中显示一个简单的范围变量。这是简化的模板代码:

<div id="Parent" data-ng-controller="MyController">
    {{ScopeVariable}} <!-- Diplays Just Fine -->

    <div>
          ... Some Buttons ...
          {{ScopeVariable}} <!-- Here it displays as {{ScopeVariable}}.  Why? -->
    </div>

    <div ng-repeat="SomeElement in SomeScopeArray">
          {{ScopeVariable}}  <!-- Diplays Just Fine -->
    </div>
</div>

相同的单一范围变量在控制器元素内部以及重复的div中正确显示。但是如果我尝试在一个简单的div中显示它,它就会失败。

0 个答案:

没有答案