AngularJS Objects
AngularJS Objects : AngularJS Objects are same as the javaScript Objects. You can perform operation same as the javaScript Objects.
AngularJS Objects simple Example using Expressions
<div ng-app="" ng-init="myobj={str1:'John',str2:'UK'}" > <p>Hi This is {{myobj.str1 + " From " + myobj.str2}}</p> </div>
Example 1
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> </head> <body> <div ng-app="" ng-init="myobj={str1:'John',str2:'UK'}" > <p>Hi This is {{myobj.str1 + " From " + myobj.str2}}</p> </div> </body> </html> |
Example of Objects with ng-bind
Example 2
<!DOCTYPE html> <html lang="en"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.3/angular.min.js"></script> </head> <body> <div ng-app="" ng-init="myobj={str1:'John',str2:'UK'}" > <p>Hi This is <span ng-bind ="myobj.str1 + ' From ' + myobj.str2"></span></p> </div> </body> </html> |
Advertisements