HTML Aside to understand Angular JS in better way

Posted By : Ravi Verma | 16-Mar-2015

HTML Aside to understand Angular JS in better way

In this blog I will tell you aside of HTML's custom attribute in order to understand AngularJS

    	Ex: 

Foo Bar

Now i add an attribute to it, then it becomes

    	Ex: 

Foo Bar

Both the example will give the same results because 'reply' attribute is being a custom attribute, i.e something is not the part of HTML standard. So it does not effect the page visually. But in the browser's memory, its still there in the DOM. To check this, you can execute below code in the browser console

    	console.log($("h1").attr("reply"));
    

HTML 5 has an official version of this i.e 'data-'

    	Ex: 

Foo Bar

You can execute it like this way-

    	console.log($("h1").attr("data-reply"));
    

Now what angular does is : just put 'ng-'

    	Ex : 

Foo Bar

"ng-reply" is a custom attribute and AngularJS uses the fact of having available browser's memory which makes decision based upon what it finds in those attributes. If you really wanna be sticky with HTML 5 then AngularJS also supports this


 

Foo Bar

THANKS

About Author

Author Image
Ravi Verma

Ravi is a seasoned technologist with excellent experience in AngularJS , NodeJS and MEAN stack. He has good experience in developing complex UIs for web and mobile applications.

Request for Proposal

Name is required

Comment is required

Sending message..