我有一个包含4列的表--Name,id,Dept,City和我提供行数据和列数据作为打字稿文件中的数组并迭代* ngFor。这是我的一段代码
<tbody>
<tr *ngFor="let rowData of data | orderBy:convertSorting()">
<td *ngFor="let column of columns; let idx=index">
<span *ngIf="idx == 1 && someCondition">
<a href="your-target-url">{{rowData[column.columnValue] | format:column.filter}}</a>
</span>
<span *ngIf="idx != 1">
{{rowData[column.columnValue] | format:column.filter}}
</span>
</td>
</tr>
</tbody>
我提供了第二列所有行的超链接,即city。如果&#34; someCondition&#34;我想让这个不可点击。是假的。我怎么做?
答案 0 :(得分:0)
Angular2, what is the correct way to disable an anchor element?
a.disabled {
pointer-events: none;
cursor: not-allowed;
}
<a [class.disabled]="!someCondition" href="your-target-url">