Angular-material md-select with images或svg

hec*_*mac 3 svg angularjs angular-material

我正在使用角度材料,我想使用md-select但是使用images/svg; 我正在使用md-option和ng-repeat,并且选项列表有效,但是当我选择某些内容时,我会看到文本.

这可行吗?

谢谢

<md-select ng-model="mkt.bookmaker" placeholder="Select a bookmaker">
  <md-option ng-value="opt" ng-repeat="opt in mkt.selected.matchInfo.bookmakers">
    <md-icon md-svg-src="{{ opt.logo }}"></md-icon>{{ opt.name }}
  </md-option>
</md-select>
Run Code Online (Sandbox Code Playgroud)

这里有一些截图: 在此输入图像描述 在此输入图像描述

hec*_*mac 10

我找到了一种在角度材料github中使用md-select的好方法

这里有解决方案的plunker,并在预览下方.

控制器:

var app = angular.module('DemoApp', ['ngMaterial']);

app.controller('MainCtrl', function($scope) {

    $scope.options = [
      {
        name: 'Rome',
        size: '200€',
        image: 'http://lorempixel.com/120/60/cats/'
      },
      {
        name: 'Naples',
        size: '230€',
        image: 'http://lorempixel.com/120/60/food/'
      }
      ];

      $scope.currOption =   $scope.options[1];

      $scope.updateData = function(){
        $scope.options = [
          {
            name: 'London',
            size: '400€',
            image: 'http://lorempixel.com/60/60/abstract/'
          },
          {
            name: 'Paris',
            size: '900€',
            image: 'http://lorempixel.com/60/60/nature/'
          },
          {
            name: 'Rome',
            size: '200€',
            image: 'http://lorempixel.com/60/60/sport/'
          },
          {
            name: 'Naples',
            size: '230€',
            image: 'http://lorempixel.com/60/60'
          }
          ];

          $scope.currOption =   $scope.options[1];
      }

});
Run Code Online (Sandbox Code Playgroud)

我的Html:

    <md-select data-ng-model="currOption">
      <md-select-label><img src="{{ currOption.image }}" /></md-select-label>
        <md-option data-ng-value="opt" data-ng-repeat="opt in options"><img src="{{ opt.image }}" /></md-option>
    </md-select>
Run Code Online (Sandbox Code Playgroud)