smartmouse
smartmouse

Reputation: 14404

Angular2 and W3C HTML validation

I'm developing an app with Angular2 and since I use directives or custom tags in the code, it can't be validated by W3C HTML validation.

For example if I use <my-component> element or *ngIf directive or some one way/two way binding elements, such as (click) or [(ngModel)], it can't be valid for any W3C validator.

I think I should replace them with elements that are validable.

So, starting from Angular2 documentation, I created the following summary for replacement:

Is this the right way for every element of my list to write code that is compliant with W3C standards?

Upvotes: 3

Views: 1654

Answers (1)

Tim Consolazio
Tim Consolazio

Reputation: 4888

You can "unpack" the *ngFor (and so on) syntactic sugar.

An excellent explanation of this is actually offered in the Tour of Heroes angular 2 tutorial (looking for link...)

Ah found it.

https://angular.io/docs/ts/latest/guide/template-syntax.html#!#star-template

Go to the "* and Template" section.

Upvotes: 0

Related Questions