title: Save form data inside ng-dialog modal
body: <p>So I have a form inside an ng-dialog plugin for angular js. The contents of the ng-dialog is loaded from external html file. The problem is that when I try to save the data it is undefined. I suspect that I am missing updating the ng-model that I use, but it is not clear how to do it. I have looked to some similar examples, but it still does not work.I want to collect the data when the button inside the form is pressed, not when the dialog is closed, but when closed will do as well. Here is my code:</p>
  
  <p>angular.app.js</p>
  
  <pre><code>myApp.controller('RequestController', function ($scope, $http, $location, $window, subtitleRequestService, $sce, subtitlesApiServiceUrl, helperService, ngDialog) {
  
      $scope.string_identifier = helperService.getParameterByName("v");
      $scope.availableSubtitles = null;
  
      $scope.request = {
          status: "pending",
          status_reason: "",
          status_reason_f: ""
      };
  
      var getAvailableSubtitles = function()
      {
          subtitleRequestService.getAvailableSubtitlesForRequest().then(
              function (res) {
                  var subs = res.data.message;
                  $scope.availableSubtitles = subs;
              },
              function () {
                  alert('Error');
              }
          );
      };
  
      $scope.saveStatus = function()
      {
          var sts = ($scope.request.status_option === "accepted" ? $scope.request.status_reason : $scope.request.status_reason_f);
          $http.post(subtitlesApiServiceUrl + "changeRequestStatus/request_id/" + $scope.string_identifier + "/status/" + $scope.request.status + "/status_reason/" + sts)
              .success(function (data, status, headers, config) {
                  alert(data.message);
              }).error(function (data, status, headers, config) {
                  alert(data);
              });
      };
  
      $scope.changeStatus = function()
      {
          getAvailableSubtitles();
          var dialogInstance = ngDialog.open({
              //appendTo: window.parent.document.getElementsByTagName('body'),
              template: "/templates/change-request-status.html",
              scope: $scope,
              controller: 'RequestController',
              className: 'ngdialog-theme-default'
          });
      };
  });
  </code></pre>
  
  <p>externalTeamplate.html</p>
  
  <pre><code>&lt;div class="ngdialog-message" ng-controller="RequestController"&gt;
      &lt;h3&gt;Schimbă status&lt;/h3&gt;
      &lt;div class="form"&gt;
          &lt;form class="form" name="$scope.request"&gt;
              &lt;div class="row"&gt;
                  &lt;label for="status_options"&gt;Status&lt;/label&gt;
                  &lt;select name="status_options" id="status_options" ng-model="request.status_option"&gt;
                      &lt;option value="pending" selected="selected"&gt;În procesare&lt;/option&gt;
                      &lt;option value="accepted"&gt;accepted&lt;/option&gt;
                      &lt;option value="rejected"&gt;rejected&lt;/option&gt;
                      &lt;option value="deleted"&gt;deleted&lt;/option&gt;
                      &lt;option value="in_translation"&gt;in_translation&lt;/select&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
              &lt;div class="row" ng-show="request.status_option !== 'accepted'"&gt;
                  &lt;label for="status_reason"&gt;Reason:&lt;/label&gt;
                  &lt;input type="text" id="status_reason" size="35" maxlength="144" ng-model="request.status_reason" /&gt;
              &lt;/div&gt;
  
              &lt;div class="row" ng-show="request.status_option=='accepted'"&gt;
                  &lt;label for="status_reason_f"&gt;Please select:&lt;/label&gt;
                  &lt;select id="status_reason_f" ng-repeat="(key, value) in availableSubtitles" ng-model="request.status_reason_f"&gt;
                      &lt;option value="{{key}}"&gt;{{value}}&lt;/option&gt;
                  &lt;/select&gt;
              &lt;/div&gt;
          &lt;/form&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="ngdialog-buttons"&gt;
      &lt;button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="saveStatus()"&gt;Salvează&lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>What am I missing? Thanks!</p>