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>
</body>
</html>

Output:


Cheers!!!

No comments:

Post a Comment