AngularJS Arrays

Let’s look at an example of Angular JS expressions with arrays.

In this example, we are going to define an array which is going to hold the marks of a student in 4 subjects. In the view, we will display the value of these marks accordingly.

<!DOCTYPE html>
    <meta chrset="UTF 8">
    <title>Event Marksheet</title>

<script src=""></script>
<script src=""></script>

<h1> Script Guru Global Event</h1>

<div ng-app="" ng-init="marks=[21,25,19,22]">

    Student Marks<br>&nbsp;&nbsp;&nbsp;
    Subject1 : {{marks[0] }}<br>&nbsp;&nbsp;&nbsp;
    Subject2 : {{marks[1] }}<br>&nbsp;&nbsp;&nbsp;
    Subject3 : {{marks[2] }}<br>&nbsp;&nbsp;&nbsp;
    Subject4 : {{marks[3] }}<br>&nbsp;&nbsp;&nbsp;


Leave a Reply

Your email address will not be published. Required fields are marked *