使用双花括号评估时遇到问题。我有几个页面组织如下:
index.html :(仅包含ng-view)
...
<body>
<div class="view-container">
<div ng-view class="view-frame"></div>
</div>
<script src="../lib/jquery/jquery-1.10.2.js"></script>
<script src="../lib/angular/angular.js"></script>
<script src="../lib/angular/angular-route.js"></script>
<script src="../lib/angular/angular-animate.js"></script>
<script src="../lib/angular/angular-resource.js"></script>
<script src="../assets/js/ui-bootstrap.js"></script>
<script src="../assets/js/bootstrap-transition.js"></script>
...
<script src="../js/app.js"></script>
<script src="../js/services.js"></script>
<script src="../js/controllers.js"></script>
<script src="../js/filters.js"></script>
<script src="../js/directives.js"></script>
</body></html>
的login.html:
<div id="bignavbar" class="navbar navbar-banner navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
...
</div> <!-- /container -->
home.html的:
<div class="navbar navbar-default navbar-fixed-top">
<div class="navbar-inner">
<div class="container-fluid">
...
<li><a href="#/profile">Profile {{ 1 + 1 }}</a></li>
<li><a href="#/help">Help</a></li>
...
</div><!--/.nav-collapse -->
</div>
</div>
</div>
...
表达式的评估在login.html中运行良好,但在其他页面中没有,例如在home.html中尝试简单的{{1 + 1}}时。如果我将home.html的代码放在login.html文件中,则评估有效,但如果我将文件login.html保存为home2.html,则评估将无法在home2.html中运行...
看起来html格式存在问题,但我很遗憾......
你有什么想法吗?