Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Can you please tell me how to remove below message on VS code editor?

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

Above message shows on below code

 <div *ngIf="isBornOn">

 </div>
like image 996
Sampath Avatar asked Apr 28 '17 16:04

Sampath


3 Answers

I think it has to do with the vscode-htmlhint plugin, try disable it.

If that removed the warning you can disable just that rule by setting attr-lowercase to false.

Read more about the configuration of this plugin here

In VSCode you can set the following settings to disable it.:

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

If don't want lose warning when use attributes that don't follow lower case rule. Instead of, you can define an attribute white list:

"htmlhint.options": {
    "attr-lowercase": [
      "*ngIf",
      "ngIf",
      "*ngFor",
      "ngFor",
      "ngSwitch",
      "ngModel"
    ],
    "doctype-first": false
  },

Also can add doctype-first to avoid that message on every component.

like image 72
Stefan Karlsson Avatar answered Oct 09 '22 04:10

Stefan Karlsson


Anyone looking to solve this from another IDE such as Eclipse or Codemix, simply create a file called .htmlhintrc place this in /<angular-project>/src/.htmlhintrc and change the values as you see fit, mine are:

{
    "tagname-lowercase": false,
    "attr-lowercase": false,
    "attr-value-double-quotes": true,
    "doctype-first": false,
    "tag-pair": true,
    "spec-char-escape": true,
    "id-unique": true,
    "src-not-empty": true,
    "attr-no-duplication": true,
    "title-require": true
}

Re-open the tab if not automatically resolved or then restart the IDE.

like image 26
dale Avatar answered Oct 09 '22 05:10

dale


enter image description here

enter image description here

Under VS Code - Extensions (left sidebar - box-shaped icon) - Disable this plugin or uninstall if required.

Then Reboot

like image 1
Surya R Praveen Avatar answered Oct 09 '22 05:10

Surya R Praveen