Sage-Bionetworks / sagebio-collaboration-portal

Collaboration Portal developed by Sage Bionetworks
1 stars 0 forks source link

Component XXX must have a template or templateUrl #401

Open tschaffter opened 5 years ago

tschaffter commented 5 years ago

VSCode show a similar error for all our Angular components:

Component 'ResourceAppPageComponent' must have a template or templateUrl

Our components do define template. It seems that it's because we load them using require() that triggers the error message.

tschaffter commented 5 years ago

This post suggests that installing @angular/language-service solves the issue.

Simply adding it to the list of dependencies doesn't solve the problem.

tschaffter commented 5 years ago

https://github.com/angular/angular/issues/17541

tschaffter commented 5 years ago

On June 2017: "The Angular language service is intended to be used in AOT compliant applications. There are several limitations, beyond the one in this issue, that would prevent the language service from working in a non-AOT'able JIT application."

"angular2-template-loader cannot work with AOT either. And require not being allowed is why there is the angular2-template-loader, for auto-switching between JIT and AOT."

Our project uses angular2-template-loader.

@TheRobBrennan I'm not very familiar with AOT besides what I read here: https://blog.nrwl.io/angular-is-aot-worth-it-8fa02eaf64d4. Do you have additional insight into this issue?

TheRobBrennan commented 5 years ago

@tschaffter Hm I'm not familiar with AOT, either. This is interesting - definitely worth taking a look at once higher priority things are hammered out.