AngularJS template variable not working/displaying

2019-09-11 04:17发布

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.

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>

1条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-11 05:09

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>
查看更多
登录 后发表回答