AngularJS模板变量在IE11中无法工作/显示 [英] AngularJS template variable not working/displaying in IE11
问题描述
我有一个指令,在angularJS项目中显示一个字体框。代码块在其他浏览器中工作正常,但在IE(10,& 11)中,模板变量未被处理,{{currentFont}}实际显示在浏览器中而不是它所代表的变量中。
I have a directive that displays a font box in an angularJS project. The block of code works fine in other browsers, but in IE (10, & 11), the template variable is not processed and "{{ currentFont }}" actually displays in the browser instead of the variable it represents.
我还将currentFont变量添加到div的类中,以查看它是否会在IE11中处理,并且它运行正常。它只是标签内部的变量才是问题所在。
I also added the currentFont variable to the div's class to see if that would process in IE11, and it worked fine. It's just the variable that is inside of the tag that is the problem.
我认为这是一个常见问题,很容易修复。有没有人有任何想法?
I assume this is a common problem and easy to fix. Does anyone have any ideas?
<div id="fnt-select" class="select-box {{ currentFont }}" ng-class="{disabled: !selectedTextField}" ng-click="!selectedTextField || toggleSelect($event)">
{{currentFont}}
</div>
推荐答案
答案是使用ng-bind
The answer was to use ng-bind
<div id="fnt-select" ng-bind="currentFont" class="select-box {{ currentFont }}" ng-class="{disabled: !selectedTextField}" ng-click="!selectedTextField || toggleSelect($event)"></div>
这篇关于AngularJS模板变量在IE11中无法工作/显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!