How to get index from template inside prime-ng carousel in Angular2?

Viewed 8764

I have used below code to show data uploaded from excel inside template tag using prime-ng carousel in angular 2.

exceldata.html:-

<p-carousel headerText="Category" [value]="ExcelRowDatas" class="pcaro">
   <template ngFor let-ExcelRowData [ngForOf]="ExcelRowDatas" let-i="index" pTemplate="item">
       <div class="ui-grid ui-grid-responsive">
          <div class="ui-grid-row">
             <div class="ui-grid-col-6">Index No.</div>
             <div class="ui-grid-col-6">({{i}})</div>
          </div>
          <div class="ui-grid-row">
             <div class="ui-grid-col-6">Place</div>
             <div class="ui-grid-col-6">{{ExcelRowData['Place']}}</div>
          </div>           
       </div>
   </template>
</p-carousel>

exceldata.ts:-

let ExcelRowDatas = [{"Place": "New York"}, {"Place": "London"}, {"Place": "Paris" }]

Plunker:- https://plnkr.co/edit/PUOlAQ7abbAJ7el4ciQ2?p=preview

I could not able to get index of the row inside template tag inside ng-carousel. But I was able to get index inside template without using ng-carousel. How can I get the index value inside ng-carousel with template?

1 Answers
Related