HTML Aside to understand Angular JS in better way
Posted By : Ravi Verma | 16-Mar-2015
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
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
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.