【发布时间】:2017-05-09 19:12:32
【问题描述】:
我有以下html代码sn-p。我正在使用 angular2,ng-bootstrap ng 选项卡。我的问题是单击选项卡时如何调用方法单击? 我添加了(单击),但是当我单击选项卡时,我看到方法 fetchNews() 根本没有被调用。我究竟做错了什么?
<ngb-tab title="Active" (click)="fetchNews('active')">
<ng-template ngbTabContent>
<table class="table table-sm table-striped">
<thead>
<tr>
<th>Title</th>
<th>Description</th>
<th>Attachment</th>
<th>Start Date</th>
<th>End Date</th>
<th>Actions</th>
</tr>
</thead>
<tr *ngFor="let item of news">
<td>{{item.title}}</td>
<td>{{item.description | ellipsis:25}}</td>
<td>{{item.attachmentUrl | ellipsis:25}}</td>
<td>{{item.startDate | date: 'MM/dd/yyyy hh:mm a'}}</td>
<td>{{item.endDate | date: 'MM/dd/yyyy hh:mm a'}}</td>
<td>
<button type="button" class="btn btn-secondary btn-sm" (click)="showNewsModal('active',item, true)">
Modify
</button>
</td>
</tr>
</table>
</ng-template>
</ngb-tab>
【问题讨论】:
标签: angular tabs ng-bootstrap