Is it possible to use the W3C validator for sites built in Angular.JS?

1

I have a project, which was done in Angular.JS. When I launch the project in the W3C Validator I get several errors that I would not have how to deal with.

For example: Attribute Errors: ng-controller | ng-cloak | ng-model | ng-click | ng-if | ng-repeat Error: Attribute not allowed on element.

Bad Value: Usually in the href's, or src's filled in with an angle variable {{minhaVariacel}}

Is there any possibility to be addressed so that I can validate and get the W3C seal from a site with Angular.JS?

    
asked by anonymous 05.09.2017 / 15:03

1 answer

1

According to the Angular Guide Normalization link

Normalization does:

  • Removes x- and data- from the front of the elements and attributes.
  • Converts : , - , or _ delimited to camelCase .
  • Then to validate just add data- in front of attributes, because attributes with data- prefix are valid in HTML5.

    Then the AngularJS itself will "normalize" to work as if there were data- , thus:

    • data-ng-controller=""
    • data-ng-cloak=""
    • data-ng-model=""
    • data-ng-click=""
    • data-ng-if=""
    • data-ng-repeat=""

    And for src= and href= add data-ng- to the prefix, like this:

    • data-ng-src=""
    • data-ng-href=""

    Ready, your site should validate.

        
    11.09.2017 / 17:54