'Angular 10 “No definition found for …” in HTML component in Visual Studio Code
I'm working with angular 10 in VSCode and everything was working fine until today. Suddenly I can't go to definition from HTML component neither via F12, right click - Go to definition nor Ctrl+click.
Go to definition works just on typescript components, also I don't get any errors except "No definition found for...."
I've tried updating VS Code, reinstalling VS Code and reinstalling extensions: Angular Essentials by John Papa Angular Language Service Angular Snippets
Also I experience the same behavior on all of my projects (two of them).
Thanks!
Solution 1:[1]
In my case, after several tries, I found the cause was an *ngIf="whatever" in the parent DOM element and in some other cases in other elements in the same level, after removing this, all definitions were reachable again... this is a bug As a workaround, I downgraded Angular Language Service to 11.2.0
Solution 2:[2]
work for me....
To enable the latest Language Service features, set the strictTemplates option in tsconfig.json by setting strictTemplates to true, as shown in the following example:
content_copy "angularCompilerOptions": { "strictTemplates": true }
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | |
Solution 2 | Jonathan Castro Hernandez |