Angular JS Views are written in HTML5 . HTML5 is a computer language and as such it has its own vocabulary, syntax and grammar. However, sometimes the documents written in HTML5 do not follow those grammar rules, and therefore they are considered invalid HTML5 files.
The process of verifying whether an HTML5 document follows the language grammar and rules is called "Validation". Validity is a quality criteria for an HTML5 web page.
We'll use the best HTML5 validator: the online free tool by the W3C consortium: the HTML5 Markup Validator :
HTML5 Markup Validation for AngularJS
First thing to do is to browse to the HTML5 Markup Validator :
Here select the "Validate by direct input" tab:
Open your AngularJS View:
Copy the AngularJS View and paste it inside the textarea at the W3C Markup Validator:
Click the "Check" button, and you will receive a bunch of validation errors:
Scroll down the web page to see the errors that the tool found:
As you can see, the errors found refer to an Attribute not found in HTML5 grammar. Let's fix it by replacing all "ng-xxx" directives with "data-ng-xxx":
Again, copy-paste the markup into the Validator:
Use the tool again to find that the HTML5 document is now "valid" :
That All!!! In this article we learned Step by Step How to perform HTML5 Markup Validation for AngularJS in 5 minutes.
Happy programming.....
by Carmel Schvartzman
כתב: כרמל שוורצמן
Informative Blog
ReplyDeleteAngular JS Online training
Angular JS training in hyderabad