Articles → ANGULAR.JS → Create objects in ng-init directive in angular.js

Create objects in ng-init directive in angular.js






Syntax


Object_name={property1:value, property2:value}






< div ng-app = ""
ng-init = "student={name:'Karan',address:'Gurgaon'}"> Name: <p ng-bind = "student.name"> </p>
        Address: <p ng-bind="student.address"></p> </div>



Output



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Wednesday, May 20, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250