title: Saving values in to array and displaying it based on the number
body: <p>I have the following code written in angular JS</p>
  
  <pre><code>&lt;html lang="en" ng-app="person_info"&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8"&gt;
  &lt;title&gt;Person info&lt;/title&gt;
  &lt;script src="../angular.min.js"&gt;&lt;/script&gt;
  &lt;script src="controller_class2.js"&gt;&lt;/script&gt;
  &lt;style type="text/css"&gt;
  .forms{width:200px;height:300px;padding:75px;float:left;background:#CCC;}
  .deatils{width:200px;height:auto;padding:100px;float:left;background:#CCC;margin-    left:10px;}
  .fields {background:#999999;float: left;height:120px;padding: 20px;width:260px;}
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body ng-controller="info"&gt;
  &lt;div class="forms"&gt; Name:&lt;/br&gt;
    &lt;input type="text" value="name" ng-model="person.name"&gt;
    &lt;/br&gt;
    &lt;/br&gt;
    First Name :&lt;/br&gt;
    &lt;input type="text" value="fname" ng-model="person.firstname"&gt;
    &lt;/br&gt;
    &lt;/br&gt;
    Phone Number :&lt;/br&gt;
    &lt;input type="number"  value="number" ng-model="person.number"&gt;
    &lt;/br&gt;
    &lt;/br&gt;
    Email :&lt;/br&gt;
    &lt;input type="email" value="email" ng-model="person.email"&gt;
    &lt;/br&gt;
    &lt;/br&gt;
    Address :&lt;/br&gt;
    &lt;input type="text" value="address" ng-model="person.address"&gt;
    &lt;/br&gt;
    &lt;/br&gt;
    &lt;input type="submit" value="submit" name="submit" ng-click="test()"&gt;
  &lt;/div&gt;
  
  &lt;div class="deatils"&gt;
  &lt;p&gt;Name : {{person.name}}&lt;/p&gt;
  &lt;p&gt;First Name : {{person.firstname}}&lt;/p&gt;
  &lt;p&gt;Phone Number: {{person.number}}&lt;/p&gt;
  &lt;p&gt;Email : {{person.email}}&lt;/p&gt;
  &lt;p&gt;Address :{{person.address}}&lt;/p&gt;&lt;/br&gt;&lt;/br&gt;
   &lt;p&gt;Details in json format : &lt;/br&gt;{{ person | json }}
  &lt;/div&gt;
  
  &lt;div class="fields"&gt;
  Submit the persons serial number to display his details
     &lt;/br&gt;
    &lt;/br&gt;
  &lt;input type="number" &gt;
    &lt;/br&gt;
    &lt;/br&gt;
  &lt;input type="submit" value="submit number"&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Controller code</p>
  
  <pre><code>var person_info = angular.module('person_info', []);
  
  person_info.controller('info', function($scope) {
    $scope.test = function () {
      console.log($scope.person);
    }
  });
  </code></pre>
  
  <p>When the user fills the form and click on submit button i want the details to be saved into a array and clear all the field so that the next users details can be filled. each user details will be stored in the array. </p>
  
  <p>i have also created a text field where user can enter the serial number of the user whose detail have to be displayed. for example when i enter the value 3 and submit this. the 3rd person's details in the array have to be displayed. </p>