0

When I use custom directives of angular, the html page fails in w3 validation. Help me to overcome this issue.

Eg:

<div>
    <share-news news-title="{{...}}" news-content="{{...}}"></share-news>
</div>

When I use the above code,

I am getting the error like Element share-news not allowed as child of element div in this context. (Suppressing further errors from this subtree.)

Gianmarco
  • 2,536
  • 25
  • 57

1 Answers1

0

While the initial source of the page body (before angular processes an ng-app element) may not adhere to the W3C standards, if you use "replace: true" in directives, custom elements are replaced by a template HTML, which can be valid. So, in this case, you can think about an angular element as just a placeholder that is replaced with the terminal HTML output.

Justin
  • 1,050
  • 11
  • 26