1
Angular2 HTML模板中有很长的代码。 如何重构此代码< tr>在较短的版本。或将其移动到@Directive。?如何将Angular2 HTML中的代码段重构为较短的版本?
activeContact - 它在@Component类中定义变量,以便从代码中访问选定的行?
类。主动从bootstrap3
<tr
*ngFor="let contact of clientsData.contacts"
[class.active] = "activeContact && contact.contactId == activeContact.contactId"
(click)="activeContact = contact" class ="gm-pointer"
>
<td>{{contact.name}}</td>
<td>{{contact.surname}}</td>
</tr>
更改: 更名< TD>到< TR>