8

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!

user3746480
  • 333
  • 5
  • 17

3 Answers3

4

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

LeonardoX
  • 1,113
  • 14
  • 31
4

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 }

https://angular.io/guide/language-service

0

Not sure if it helps anyone, but I found that I just needed to update to the latest Angular Language Service. I switch to using VS code preview and noticed a similar error compared to when I was using Webstorm.

After I installed the Angular Language Service package under VS extensions, it fixed this issue. https://marketplace.visualstudio.com/items?itemName=Angular.ng-template

Quentin Mayo
  • 390
  • 4
  • 11