angularjs 应用未在 ui-select 字段的占位符文本中显示特殊字符
angularjs app not showing special characters in placeholder text in ui-select field
我有一个多语言 angular 应用程序,其中一种语言有特殊字符,例如变音符号。它们在标签、标题、标题上显示良好,但在占位符文本中显示不佳。
这是我的代码:
<label translate="app.title"></label>
<ui-select name="myoption" ng-model="app.option" theme="selectize">
<ui-select-match placeholder="{{ 'app.placeholder' | translate }}">
{{$select.selected.value}}
</ui-select-match>
<ui-select-choices repeat="o.key as o in tras.app.options | filter: $select.search">
<div ng-bind-html="o.value | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
标签标题有一个特殊字符,如 ä 或 ö,可以正常显示。但相同的词也在占位符文本中,但显示为 ä
。
为什么会这样?有人可以帮忙修复吗?
这里讨论了这个问题https://github.com/angular-translate/angular-translate/issues/1282
您需要关闭清理:
$translateProvider.useSanitizeValueStrategy(null);
使用 ng-bind-html
作为标记:
<ui-select-match placeholder="{{ 'app.placeholder' | translate }}"
ng-bind-html="selected.selected.value">
</ui-select-match>
但对于占位符,您必须使用上面的 AHC 解决方案。
我有一个多语言 angular 应用程序,其中一种语言有特殊字符,例如变音符号。它们在标签、标题、标题上显示良好,但在占位符文本中显示不佳。 这是我的代码:
<label translate="app.title"></label>
<ui-select name="myoption" ng-model="app.option" theme="selectize">
<ui-select-match placeholder="{{ 'app.placeholder' | translate }}">
{{$select.selected.value}}
</ui-select-match>
<ui-select-choices repeat="o.key as o in tras.app.options | filter: $select.search">
<div ng-bind-html="o.value | highlight: $select.search"></div>
</ui-select-choices>
</ui-select>
标签标题有一个特殊字符,如 ä 或 ö,可以正常显示。但相同的词也在占位符文本中,但显示为 ä
。
为什么会这样?有人可以帮忙修复吗?
这里讨论了这个问题https://github.com/angular-translate/angular-translate/issues/1282
您需要关闭清理:
$translateProvider.useSanitizeValueStrategy(null);
使用 ng-bind-html
作为标记:
<ui-select-match placeholder="{{ 'app.placeholder' | translate }}"
ng-bind-html="selected.selected.value">
</ui-select-match>
但对于占位符,您必须使用上面的 AHC 解决方案。