title: How to pass arguments from a table to a modal in angular?
body: <p>I am new to AngularJS and I need some help with a function or two.</p>
  
  <p>I'm trying to pass an object to a modal ( or pop-up how I defined it ) and I've done that, but when I try to hit the "Save changes" button from the modal I hit a brick wall, the object is empty. I need to update the JSON object with a new name. I know I have to create a controller and a directive to this angular, but I don't know how to start. I already have the update functions stored in other controllers. I'm doing all this on a single page, the 'index.html'. Any suggestions on how I can do this ?</p>
  
  <p>Thanks in advance.</p>
  
  <p>PS: If there is anything needed, please tell me to post. Thanks again.</p>
  
  <pre><code> angular.module('ConsultantCompany').controller('CompanyController', ['CompanyService', '$scope', '$log', function(CompanyService, $scope, $log) {
          var ctrl = this;
  
          ctrl.updateCompany = function(form) {
              CompanyService.update(form);
              $log.info("Company updated");
          }
  
          ctrl.updating = function(company) {
              $log.info("Company: ", company);
  
              $('#popup-1').fadeIn(250);
          }
  }]);
  
  &lt;table class="table table-bordered"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;Company ID&lt;/th&gt;
                  &lt;th&gt;Company Name&lt;/th&gt;
                  &lt;th&gt;Update&lt;/th&gt;
                  &lt;th&gt;Delete&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt;
              &lt;tr data-ng-repeat="company in compCtrl.companies"&gt;
                  &lt;td&gt;{{company.id}}&lt;/td&gt;
                  &lt;td&gt;{{company.name}}&lt;/td&gt;
                  &lt;td&gt;&lt;button type="button" class="btn btn-xs btn-success" data-ng-click="compCtrl.updating(company)"&gt;Update&lt;/button&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;button type="button" class="btn btn-xs btn-danger" data-ng-click="compCtrl.deleteCompany(company)"&gt;Delete&lt;/button&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/tbody&gt;
      &lt;/table&gt;
  
  &lt;form name="form" id="name" data-ng-submit="compCtrl.updateCompany(form)" novalidate&gt;
          &lt;h1&gt;Updating company: &lt;/h1&gt;
          &lt;label&gt;Company name&lt;/label&gt;
          &lt;input type="text" class="form-control" placeholder="Enter the new name of the company you want to update" required&gt;
          &lt;br&gt;
          &lt;button type="button" class="btn btn-sm btn-success" data-ng-click="compCtrl.updateCompany(form)"&gt;Save changes&lt;/button&gt;
          &lt;button type="button" class="btn btn-sm btn-danger" onclick="close_popup(1);"&gt;Close&lt;/button&gt;   
      &lt;/form&gt;
  </code></pre>