Google+

Friday, January 9, 2015

HTML5 Markup Validation for AngularJS

In this article we describe Step by Step How to perform HTML5 Markup Validation for AngularJS in 5 minutes,  by validating a sample AngularJS HTML5 View markup , and introducing the W3C Online Markup Validator .
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



HTML5  Markup Validation for AngularJS





First thing to do is to browse to the HTML5 Markup Validator :


HTML5 Markup Validation for AngularJS 1

Here select the "Validate by direct input" tab:

HTML5 Markup Validation for AngularJS 2


Open your AngularJS View:

HTML5 Markup Validation for AngularJS 3


Copy the AngularJS View and paste it inside the textarea at the W3C Markup Validator:

HTML5 Markup Validation for AngularJS 4


Click the "Check" button, and you will receive a bunch of validation errors:

HTML5 Markup Validation for AngularJS 5


Scroll down the web page to see the errors that the tool found:

HTML5 Markup Validation for AngularJS 6


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":

HTML5 Markup Validation for AngularJS 7

Again, copy-paste the markup into the Validator:


HTML5 Markup Validation for AngularJS 8


Use the tool again to find that the HTML5 document is now "valid" :

HTML5 Markup Validation for AngularJS 9





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


כתב: כרמל שוורצמן



1 comment: