2016-03-05 50 views
0

我想解决翻译问题。图片您使用标准的角度带选择例如在应用程序:翻译角度带选择图标标签

$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"}]; 

这怎么可能,使用的角度转换的拉布勒可变文本(齿轮,环球,心...)翻译?

回答

0

好吧,我想我已经解决了我的问题。对于任何一个谁是有兴趣的解决方案:

控制器:

$scope.selectedSecurityColours = []; 
 
\t $scope.securityColours = [{"value":"black","label": {text: "BLACK", icon: '<i class="fa fa-circle fa-circle-black"/>'}}, 
 
\t     {"value":"green","label": {text: "GREEN", icon: '<i class="fa fa-circle fa-circle-green"/>'}}, 
 
\t     {"value":"red","label": {text: "RED", icon: '<i class="fa fa-circle fa-circle-red"/>'}}, 
 
\t     {"value":"blue","label": {text: "BLUE", icon: '<i class="fa fa-circle fa-circle-blue"/>'}}, 
 
\t     {"value":"silver","label": {text: "SILVER", icon: '<i class="fa fa-circle fa-circle-silver"/>'}}, 
 
\t     {"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> 
 
\t \t \t \t \t </button>

的诀窍是正确使用bs-options属性。我找不到任何文件,描述我的解决方案,但似乎正常工作。