visual-studio-code - [ *ngIf ] 的属性名称必须为小写

标签 visual-studio-code

你能告诉我如何在 VS code 上删除以下消息吗?编辑?

The attribute name of [ *ngIf ] must be in lowercase.

上面的消息显示在下面的代码中

 <div *ngIf="isBornOn">

 </div>

最佳答案

我认为这与有关vscode-htmlhint 插件,尝试禁用它。

如果删除了警告,您可以通过设置 attr-lowercase 来禁用该规则。为假。

阅读有关此插件配置的更多信息 here

在 VSCode 中,您可以设置以下设置来禁用它。:

"htmlhint.options": {
  "attr-lowercase": false
}

如果不想在使用不遵循小写规则的属性时丢失警告。相反,您可以定义一个 attribute white list :
"htmlhint.options": {
    "attr-lowercase": [
      "*ngIf",
      "ngIf",
      "*ngFor",
      "ngFor",
      "ngSwitch",
      "ngModel"
    ],
    "doctype-first": false
  },

也可以加doctype-first以避免在每个组件上出现该消息。

关于visual-studio-code - [ *ngIf ] 的属性名称必须为小写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43684599/

相关文章:

git - 如何使用 Git 在 Visual Studio Code 中的分支之间切换?

javascript - VSCode 使用 JavaScript 自动导入 React Native

html - 在 Visual Studio Code 中格式化 html 代码,使属性位于不同的行上?

python - Visual Studio 代码终端

visual-studio-code - 如何通过终端以全新状态打开 VSCode 中的文件夹?

Python - 导入 mysql - IDLE/工作 Visual Studio/不工作

python - 如何从 Visual Studio Code 中执行 Python 代码

npm - 如何设置 Visual Studio Code

javascript - VSCode & Flow - 转到定义不起作用

visual-studio-code - Flutter:具有@override 列表的 VSCode 快捷方式