title: How to send form data from one page to another page using angularjs
body: <p>Can any on help me to send the data from one page to another page using AngularJS.</p>
  
  <p>Service code</p>
  
  <pre><code>var module = angular.module('app', []);
  module.service('ContactService', function () {
  var uid = 1;
  var contacts = [{
      id: 0,
          'fname': 'Supriya',
          'mobile': '8985335701',
          'mail': 'hello@gmail.com',
          'age': '20',
          'gender' : 'female'
  }];
  this.save = function (contact) {
      if (contact.id == null) {
          contact.id = uid++;
          contacts.push(contact);
      } else {
          for (i in contacts) {
              if (contacts[i].id == contact.id) 
                  {
                  contacts[i] = contact;
              }
          }
      }
  }
  this.list = function () {
      return contacts;
  }
  });
  </code></pre>
  
  <p>Controller code:</p>
  
  <pre><code> module.controller('ContactController', function ($scope, ContactService) {
  $scope.contacts = ContactService.list();
  $scope.saveContact = function () {
      ContactService.save($scope.newcontact);
      $scope.newcontact = {};
  }
  })
  </code></pre>
  
  <p>Html page:</p>
  
  <pre><code> &lt;body&gt;
  &lt;div ng-app="app" ng-controller="ContactController"&gt;
  &lt;form&gt;
  &lt;label&gt;Full Name:&lt;/label&gt;
  &lt;input type="text" ng-model="newcontact.fname"&gt;&lt;br&gt;
  &lt;label&gt;Mobile Number:&lt;/label&gt;
  &lt;input type="text" ng-model="newcontact.mobile"&gt; &lt;/br&gt;
  &lt;label&gt; E-Mail:&lt;/label&gt;
  &lt;input type="email" ng-model="newcontact.mail"&gt; &lt;/br&gt;
  &lt;label&gt; Age:&lt;/label&gt;
  &lt;input type="text" ng-model="newcontact.age"&gt; &lt;/br&gt;
  &lt;label&gt; Gender: &lt;/label&gt;
  &lt;input type="radio" ng-model="newcontact.gender" value="male"&gt;Male
  &lt;input type="radio" ng-model="newcontact.gender" value="female"&gt;Female
  &lt;input type="hidden" ng-model="newcontact.id" /&gt;
  &lt;br&gt;
  &lt;input type="button" value="Save" ng-click="saveContact()" /&gt;
  &lt;table border=1px&gt;
  &lt;thead&gt; 
  &lt;tr&gt;
  &lt;th&gt;Full Name&lt;/th&gt;
  &lt;th&gt;Mobile Number&lt;/th&gt;
  &lt;th&gt;Email&lt;/th&gt;
  &lt;th&gt;Age&lt;/th&gt;
  &lt;th&gt;Gender&lt;/th&gt;
  &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
  &lt;tr ng-repeat="contact in contacts"&gt;
  &lt;td&gt;{{ contact.fname }}&lt;/td&gt;
  &lt;td&gt;{{ contact.mobile }}&lt;/td&gt;
  &lt;td&gt;{{ contact.mail }}&lt;/td&gt;
  &lt;td&gt;{{ contact.age }}&lt;/td&gt;
  &lt;td&gt;{{ contact.gender }}&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  &lt;/table&gt;    
  &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>On click of save button the details which are entered in the form should be send to another page called <code>index.html</code>.</p>