在我开始重写代码之前:
使用angular-gettext,无论如何都要处理这些类型的内联三元条件?应用翻译过滤器似乎不是一个选项......
<a uib-tooltip="{{favourite?'remove from favourites':'add to favourites'}}" ng-click="someaction()">something</a>
提前致谢!
答案 0 :(得分:0)
我只是将字符串移动到控制器(参见ng-gettext docs):
angular.module("someApp").controller("someController", ['gettext', function (gettext) {
$scope.favoriteRemove = gettext("remove from favorites"),
$scope.favoriteAdd = gettext("add to favorites");
}]);
HTML
<a uib-tooltip="{{favourite?favoriteRemove:favoriteAdd}}" ng-click="someaction()">something</a>