2016-10-28 2 views
0

데이터베이스에서 오는 번호가 있는데이 번호에 대해 몇 가지 목록을 반복하고 싶습니다. 다시 말해서 366은 366 번 반복해야하는 데이터베이스에서 가져옵니다.주어진 번호로 md-virtual-repeat

아래 코드는 작동하지만 각도 재료의 md-virtual-repeattrack by 속성을 지원하지 않습니다. 내가 원하는 건 살 수있는거야?

$scope.number = 5; //Coming from database 

$scope.getNumber = function(num) { 
return new Array(num); 
} 

<li ng-repeat="i in getNumber(number) track by $index">{{$index+1}}</li> 
+0

왜 당신이 너무 재질에 동일한 코드를 사용 해달라고? – Sajeetharan

+0

@Sajeetharan'md-virtual-repeat does'는'track by '속성을 지원하지 않습니다. – Nasuh

답변

1

이 같은 것을 의미합니까? - CodePen

이것은 demo page의 Vertical Usage 예제에서 가져온 것입니다.

마크 업

<div ng-controller="AppCtrl as ctrl" ng-cloak="" class="virtualRepeatdemoVerticalUsage" ng-app="MyApp"> 
    <md-content layout="column"> 
    <md-virtual-repeat-container id="vertical-container"> 
     <li md-virtual-repeat="item in ctrl.items" class="repeated-item" flex=""> 
     {{$index + 1}} 
     </li> 
    </md-virtual-repeat-container> 
    </md-content> 
</div> 

JS

(function() { 
    'use strict'; 

    angular 
     .module('MyApp',['ngMaterial', 'ngMessages', 'material.svgAssetsCache']) 
     .controller('AppCtrl', function() { 
     this.items = new Array(366);   
     }); 
})(); 
관련 문제