title: How to reuse HTML/Controller for Add/Edit user in AngularJs
body: <p>I have two separate HTML templates for Add / Edit user and hence two separate controllers. <strong>How i can have one HTML file and one controller for both Add/Edit functionality.</strong> </p>
  
  <p><strong>Add User</strong></p>
  
  <pre><code>  &lt;div&gt;
         &lt;label&gt;FirstName&lt;/label&gt;
                      &lt;div&gt;
           &lt;input type="text" name="name"  data-ng-model="register.Student.FirstName"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div&gt;
                      &lt;label&gt;LastName&lt;/label&gt;
                      &lt;div&gt;
           &lt;input type="text" name="name" data-ng-model="register.Student.LastName"&gt;
                      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Edit User</strong></p>
  
  <pre><code>  &lt;div&gt;
                      &lt;label&gt;FirstName&lt;/label&gt;
                      &lt;div&gt;
          &lt;input type="text" name="name" data-ng-model="student.Student.FirstName"&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;div&gt;
                      &lt;label&gt;LastName&lt;/label&gt;
                      &lt;div&gt;
           &lt;input type="text" name="name" data-ng-model="student.Student.LastName"&gt;
                      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>AddController</strong> which initialize FirstName and Last Name to null value. This is not the case in my EditController. </p>
  
  <pre><code>       $scope.register = {
                  User: {
                      FirstName: '',
  LastName: '',
              };
  </code></pre>
  
  <p>My route configuration</p>
  
  <pre><code> templateUrl: '/app/users/newStudent.html',
          controller: 'newStudentController',
          controllerUrl: '/app/users/newStudentController.js', 
  
         templateUrl: '/app/users/editStudent.html',
          controller: 'editStudentController',
          controllerUrl: '/app/users/editStudentController.js',
  </code></pre>