angular icon indicating copy to clipboard operation
angular copied to clipboard

Sanity check directives|pipes|providers for validitity

Open cporte opened this issue 7 years ago • 3 comments

@Component(selector: 'test-component',
                   directives: const [NgIf, NgFor],
                   template: 'It works!')
class TestComponent {
...

produces the following HTML:

<test-component>It works!</test-component>

If for some reason you were not really awake and write this:

@Component(selector: 'test-component',
                   directives: const [NgIf, NgFor, DatePipe],
                   template: 'It works!')
class TestComponent {
...

you end up with the follow HTML:

<test-component></test-component>

No visible error in pub serve nor in the dartium console. A .template.dart file for the faulty component is generated but the content is the same as if you omit the template property in Component annotation.

I didn't tested this with Angular 4 alpha

cporte avatar Jul 19 '17 16:07 cporte

https://github.com/dart-lang/angular_analyzer_plugin is doing exactly that (and more) But the installation instruction is broken since the commit https://github.com/dart-lang/angular_analyzer_plugin/commits/master from 2017-07-14 https://github.com/dart-lang/angular_analyzer_plugin/issues/392 If you check out a previous version it should work though.

zoechi avatar Jul 20 '17 10:07 zoechi

Just hit again in https://github.com/dart-lang/angular/issues/1163.

matanlurey avatar Mar 30 '18 03:03 matanlurey

Just checked it. Seems it works correct and don't throw any errors. Maybe is it already fixed?

artem-galas avatar Jan 01 '19 14:01 artem-galas