2016-12-28 6 views
2

ユーザがスクロールし続けると、ドロップダウン選択の無限リピートを設定しようとしています。ドロップダウンの値が表示されない物体の角度の仮想リピート

$ httpを使用すると、これらの行に何か試しました。しかし、それは働くように見えることはできません。

$scope.infiniteItems = { 
      numLoaded_: 0, 
      toLoad_: 0, 
      items: [], 

      // Required. 
      getItemAtIndex: function (index) { 
       if (index > this.numLoaded_) { 
        this.fetchMoreItems_(index); 
        return null; 
       } 
       return this.items[index]; 
      }, 

      // Required. 
      getLength: function() { 
       return this.numLoaded_ + 25; 
      }, 

      fetchMoreItems_: function (index) { 
       if (this.toLoad_ < index) { 
        this.toLoad_ += 10; 
        AssemblyJigsFactory.getData().then(angular.bind(this, function (obj) { 
         this.items = this.items.concat(obj.data.success.data); 
         this.numLoaded_ = this.toLoad_; 
        })); 
       } 
      } 
     }; 

私はそれがアップ空来console.log($scope.infiniteItems);場合は、

Object {numLoaded_: 0, toLoad_: 0, items: Array[0]} 

私のHTMLは、簡単なダイアログがこのマークアップ

<md-input-container class="md-block" flex-gt-sm> 
            <label>Storage Location</label> 
            <md-select ng-model="newJig.storagelocation" placeholder="Storage Location" ng-cloak> 
             <md-option> 
              <md-virtual-repeat-container id="vertical-container"> 
              <div md-virtual-repeat="item in infiniteItems" md-on-demand class="repeated-item" flex> 
               {{item.name}} 
              </div> 
              </md-virtual-repeat-container> 
              </md-option> 
             <div ng-hide="allItems.length">No items found</div> 
            </md-select> 
           </md-input-container> 

しかしstorage locationだけで任意の値を示していないとポップアップ表示されます。私は、htmlの設定が正しいかどうかはわかりません。

私は自分自身でこの

AssemblyJigsFactory.getData().then(function(res){ 

console.log(res.data.success); 
}); 

をテストしているとのデータが入って来続ける。

Object {total: 50, per_page: 25, current_page: 1, ... 

任意のアイデア?

+0

codepenなどを提供できますか? – kuhnroyal

答えて

0

私は同じ問題があったので、md-input-containerを次のように変更してください。

<md-input-container class="md-block" flex-gt-sm> 
    <label>Storage Location</label> 
    <md-select ng-model="newJig.storagelocation" placeholder="Storage Location" ng-cloak> 
     <md-virtual-repeat-container id="vertical-container"> 
      <div md-virtual-repeat="item in infiniteItems" md-on-demand class="repeated-item" flex> 
       <md-option ng-value='item.value'>{{item.name}} 
       </md-option> 
      </div> 
     </md-virtual-repeat-container>               
    <div ng-hide="allItems.length">No items found</div> 
    </md-select> 
</md-input-container> 

希望すると、これが役に立ちます。

関連する問題