我需要在一个元素上有多个数据绑定.例如,我想要一个标签上href的html数据绑定以及数据绑定.我试过这个, a
<a data-bind="html: name"
data-bind="attr: { href: url }"
data-bind="attr: { 'data-prop': xyz }">
</a>
Run Code Online (Sandbox Code Playgroud)
但这不起作用.似乎淘汰赛只支持绑定一个 data-bind属性?如何在一个元素上绑定href内部html和自定义" data-prop"属性?
我有一种情况,我需要在同一元素上使用*ngIf和*ngFor指令.我在stackoverlow上找到了很多答案,但在这种情况下没有找到答案.
我有一个表,我循环遍历对象数组并动态写入标题中的单元格:
<table border="1" width="100%">
<thead>
<tr>
<td *ngFor="let item of headerItems" *ngIf="item.visible">{{ item?.name }}</td>
</tr>
</thead>
<tbody>
...
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我想显示/隐藏对象是否包含可见设置为true.我怎样才能做到这一点?