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

Create an array in ng-init directive in angular.js






Syntax


Array_name=[element1, element2,….]



Example


<div ng-app ng-init="names=['A','B','C']">
	<p ng-bind="names[0]"></p>
	<p ng-bind="names[1]"></p>
	<p ng-bind="names[2]"></p>
</div>



Output



Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Sunday, May 17, 2015

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250