title: AngularJS $save form data in a separate hash
body: <p>Using this setup I can save a form in AngularJS.</p>
  
  <p>I want to have the data values pushed to the server (via the $save method) as defined in the name="" attributes.</p>
  
  <p>So a form submitted like this would look like this:</p>
  
  <h3>Ideal Form Data</h3>
  
  <pre><code>{
    book: {
      word : '...',
      book : '...',
      page : '...'
    }
  }
  </code></pre>
  
  <p>But instead its being submitted directly as a hash (without the inner book block).</p>
  
  <p>Here's what my form and controller looks like:</p>
  
  <h3>My Form</h3>
  
  <pre><code>&lt;div&gt;
    &lt;form data-ng-submit="save()"&gt;
      &lt;ol class="fields"&gt;
        &lt;li&gt;
          &lt;div class="label"&gt;
            &lt;label for="word"&gt;Word: &lt;/label&gt;
          &lt;/div&gt;
          &lt;div class="details"&gt;
            &lt;input type="text" name="word[word]" data-ng-model="word.word" /&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;div class="label"&gt;
            &lt;label for="book"&gt;book: &lt;/label&gt;
          &lt;/div&gt;
          &lt;div class="details"&gt;
            &lt;input type="text" name="word[book]" data-ng-model="word.book" /&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li&gt;
          &lt;div class="label"&gt;
            &lt;label for="page"&gt;page: &lt;/label&gt;
          &lt;/div&gt;
          &lt;div class="details"&gt;
            &lt;input type="text" name="word[page]" data-ng-model="word.page" /&gt;
          &lt;/div&gt;
        &lt;/li&gt;
      &lt;/ol&gt;
      &lt;nav class="actions"&gt;
        &lt;input type="submit" value="save" /&gt;
      &lt;/nav&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <h3>My Controller (Angular)</h3>
  
  <pre><code>var saveCtrl = function($scope, $routeParams, Word, $location) {
    $scope.word = Word.get({
      id : $routeParams.id 
    });
    $scope.save = function() {
      $scope.word.$save({
        id : $scope.word.id
      });
      $location.path('/').replace();
    };
  }
  </code></pre>
  
  <p>Any ideas?</p>