md-slider不能使用ng-repeat?

时间:2017-04-07 15:24:42

标签: angularjs

我无法在md-slider

上使用ng-repeat获取滑块数据

我也有滑块的间隙如果我使用ng-repeat并且无法在其上看到值。



$scope.data =  [
{
    id: 1,
    value: "1"
},
{
    id: 2,
    value: "2"
},
{
    id: 3,
    value: "3"
}
  ]
console.log($scope.data);
  $scope.clicked = function (id) {

      alert(id);
  };

<md-slider-container>
      <md-slider flex ng-model="value" ng-repeat="aa in data" aria-
       label="blue" id="blue-slider" class="md-primary">
            {{aa.value}}
       </md-slider>
       <md-input-container>
            <input flex type="number" ng-model="value" aria-label="blue" 
               aria-controls="blue-slider">
        </md-input-container>
    </md-slider-container>
    <md-button class="md-raised md-primary" ng-click=clicked(value)>Get 
    Value</md-button>
&#13;
&#13;
&#13;

enter image description here

1 个答案:

答案 0 :(得分:0)

您使用的是错误的标记。试试这个:

 <md-content>
      <md-slider-container ng-repeat="aa in data">
      <span>{{aa.value }}</span>
      <md-slider flex ng-model="color.green" min="0" max="255" aria-label="green" id="green-slider" class="md-accent">
      </md-slider>
      <md-input-container>
        <input flex type="number" ng-model="color.green" aria-label="green" aria-controls="green-slider">
      </md-input-container>
    </md-slider-container>


  </md-content>