ADVERTISEMENT


Breaking News

Recent Posts

Tuesday, December 30, 2014

How to start Angular JS

Angular JS is very well know updated js lib by google, mostly people thinks how to take first step to start it,
let me give you introduce it in very ease way;

just creating an html page and paste below code:

 <!DOCTYPE html>  
 <html>  
 <head>  
   // including angular.js lib file from google, you can download it and add locally  
   <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>  
 </head>  
 <body>  
 <div ng-app="">  
   <div>My Name: <input type="text" ng-model="myName"></div>  
   <p ng-bind="myName"></p>  
 </div>  
 </body>  
 </html>  

- In head section included angular.js file is online from google you can dowload it locally .
- ng-app it is the identifier which will define the scope of angular , if you want for whole page you can add with body tag
- ng-model directive stores/updates the value of the input field into/from a variable.
- ng-bind it will bind the value of model to this (p,input).

No comments:

Post a Comment

Designed By Published.. Blogger Templates