我正在尝试解决翻译问题。您在应用程序中使用标准角带选择示例的图像:
$scope.selectedIcon = "";
$scope.selectedIcons = ["Globe","Heart"];
$scope.icons = [{"value":"Gear","label":"<i class=\"fa fa-gear\"></i> Gear"},{"value":"Globe","label":"<i class=\"fa fa-globe\"></i> Globe"},{"value":"Heart","label":"<i class=\"fa fa-heart\"></i> Heart"},{"value":"Camera","label":"<i class=\"fa fa-camera\"></i> Camera"}];
如何使用角度平移在lable变量中翻译文本(Gear,Globe,Heart ...)?
答案 0 :(得分:0)
控制器:
$scope.selectedSecurityColours = [];
$scope.securityColours = [{"value":"black","label": {text: "BLACK", icon: '<i class="fa fa-circle fa-circle-black"/>'}},
{"value":"green","label": {text: "GREEN", icon: '<i class="fa fa-circle fa-circle-green"/>'}},
{"value":"red","label": {text: "RED", icon: '<i class="fa fa-circle fa-circle-red"/>'}},
{"value":"blue","label": {text: "BLUE", icon: '<i class="fa fa-circle fa-circle-blue"/>'}},
{"value":"silver","label": {text: "SILVER", icon: '<i class="fa fa-circle fa-circle-silver"/>'}},
{"value":"gold","label": {text: "GOLD", icon: '<i class="fa fa-circle fa-circle-gold"/>'}}]
查看:
<button type="button" class="btn btn-default" ng-model="selectedSecurityColours" data-html="1" data-multiple="1" data-animation="am-flip-x" max-length="4" max-length-html="{{'SELETED' | translate}}" placeholder="{{'CHOOSEAMOUNGTHEFOLLOWING' | translate}}" bs-options="securityColour.value as securityColour.label.icon + ' ' + (securityColour.label.text | translate) for securityColour in securityColours" bs-select>
</button>
诀窍是正确使用bs-options属性。我找不到任何文件,描述我的解决方案,但似乎工作正常。