为什么我会遇到"无法绑定x"错误?

时间:2018-05-06 13:39:30

标签: angular angular-ng-if

我在我的组件中使用了这段代码:

<button type="button" class="btn btn-primary "(click) ="toggle()" >Create</button>

并将其添加到app.component.html:

<app-table *ngif="showFirst"></app-table>
<app-form *ngif="!showFirst"></app-form>

我遇到了this error

  

无法绑定到&#39; ngif&#39;因为它不是'app-table&#39;。

的已知属性

1 个答案:

答案 0 :(得分:0)

*ngif修改为*ngIf,因为它在此区分大小写,因为它是指令而不是html属性