我看到很多答案,但没有人为我工作。
答案我发现:
选项1:
<select class="form-control" name="country" ng-model="user.country">
<option value="">choose country</option>
<option ng-repeat="item in countries" value="{{item.name}}" ng-style="background:url('../images/flage/+item.name+.png')>{{item.name}}</option>
</select>
选项2:
<select class="form-control" name="country" ng-model="user.country">
<option value="">choose country</option>
<option ng-repeat="item in countries" value="{{item.name}}" ng-style="background:url('../images/flage/+{{item.name}}+.png')>{{item.name}}</option>
</select>
选项3:
<select class="form-control" name="country" ng-model="user.country">
<option value="">choose country</option>
<option ng-repeat="item in countries" value="{{item.name}}" data-image="('../images/flage/item.name.png')">{{item.name}}</option>
</select>
选项4:
<select class="form-control" name="country" ng-model="user.country">
<option value="">choose country</option>
<option ng-repeat="item in countries" value="{{item.name}}" data-image="('../images/flage/{{item.name}}.png')">{{item.name}}</option>
</select>
有人知道怎么做吗?
答案 0 :(得分:-1)
试试这个,
table1
&#13;
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
$scope.name = 'World';
$scope.countries = [
{
'name':'india',
'flag':'http://pngimg.com/upload/flags_PNG14694.png'
},
{
'name':'USA',
'flag':'https://www.google.com/images/srpr/logo4w.png'
}
]
});
&#13;