AngularJS

AngularJS

Hide and Show using AngularJS

Sample Code: <!DOCTYPE html> <html> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="" ng-init="mySwitch=true"> <p ng-show="mySwitch">Check to see and uncheck to hide</p> <p><input type="checkbox" ng-model="mySwitch"/>Show/Hide</p> <p>{{ mySwitch }}</p> </div>  </body> </html> Output: ....

AngularJS

AngularJS tables

Sample Code: <!DOCTYPE html> <html> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="" ng-init="persons = [{firstname:'Test', lastname:'Sample'}, {firstname:'Test1', lastname:'Sample1'}, {firstname:'Test2', lastname:'Sample2'}, {firstname:'Test3', lastname:'Sample3'}, {firstname:'Test4', lastname:'Sample4'}, {firstname:'Test5', lastname:'Sample5'}]">  <table border = "1" cellspacing ....

AngularJS

AngularJS Controllers

AngularJS Controllers control the data of AngularJS applications. AngularJS controllers are regular JavaScript Objects. Sample Code: <!DOCTYPE html> <html> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="myApp" ng-controller="SampleCtrl"> First Name: <input type="text" ....

AngularJS

AngularJS Arrays

AngularJS arrays are like JavaScript arrays. Array index starts with 0. Sample Code: <!DOCTYPE html> <html> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="" ng-init="points=[1,15,19,2,40]"> <p>The third value is <span ng-bind="points[2]"></span></p> </div> ....

AngularJS

AngularJS Objects

AngularJS objects are like JavaScript objects. Sample Code: <!DOCTYPE html> <html> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script> <body> <div ng-app="" ng-init="person={firstName:'First',lastName:'Last'}"> <p>The lastname is {{ person.lastName }}</p> </div> </body> </html> Output: Cheers!!!