天天看点

Angular 的 ngIf 和 NgIf 有何区别

在Angular官方文档里,可以看到ngIf和NgIf这两种拼写混杂使用。

NgIf 指的是指令类; ngIf 指的是指令的属性名称。

指令类以 UpperCamelCase (NgIf) 拼写。 指令的属性名称以lowerCamelCase (ngIf) 拼写。

官方文档在讨论其属性和指令的作用时引用了指令类。

The guide refers to the attribute name when describing how you apply the directive to an element in the HTML template. 例如:

Angular 的 ngIf 和 NgIf 有何区别
Angular 的 ngIf 和 NgIf 有何区别

继续阅读