title: Scope inside ng-repeat isn't being defined
body: <p>In the following code I'm trying to create a form at the end of each ng-repeat and assign a value to the scope.</p>
  
  <p>For some reason the value I'm assigning (with ng-model) isn't being passed.</p>
  
  <p>If you prefer fiddle:
  <a href="https://jsfiddle.net/U3pVM/27716/" rel="nofollow">https://jsfiddle.net/U3pVM/27716/</a></p>
  
  <p>otherwise here is the code:</p>
  
  <p>app.js:</p>
  
  <pre><code>var app = angular.module('qmaker', []);
  
  app.controller('MainCtrl', [
  '$scope',
  function($scope){
  
  $scope.qstnrs = [
      //object #1
      {
      title:  'questionnaire 1',
      author: 'dave',
      questions:
          [
          {qid: 1, qtype: 'multi'},
          {qid: 2, qtype: 'cross'}
          ]
      },
  
      //object #2
      {
      title: 'questionnaire 2',
      author: 'raul',
      questions:
          [
          {qid: 1, qtype: 'lol'},
          {qid: 2, qtype: 'foreal'}
          ]
      }
  ];
  
  $scope.newQuestion = function(index) {
      console.log($scope.type);
      var question_id = $scope.qstnrs[index].questions.length +1;
      $scope.qstnrs[index].questions.push({
              qid:  question_id,
              qtype: $scope.type
          }
      );
  
  };
  
  $scope.newQstnr = function () {
      $scope.qstnrs.push({
          title: $scope.title,
          author: 'admin',
          questions: []
      });
      $scope.title = '';
  };
  }]);
  </code></pre>
  
  <p>When I try to log <code>$scope.type</code> to console I receive <em>undefined</em>.</p>
  
  <p>Here is the HTML:</p>
  
  <pre><code>&lt;html&gt;
   &lt;head&gt;
      &lt;title&gt;QMaker app&lt;/title&gt;
      &lt;script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.10/angular.min.js"&gt;&lt;/script&gt;
      &lt;script src="app.js"&gt;&lt;/script&gt;
   &lt;/head&gt;
   &lt;body ng-app="qmaker" ng-controller="MainCtrl"&gt;
      &lt;!-- This form works fine, the next is problematic --&gt;
      &lt;form ng-submit="newQstnr()"&gt;
          &lt;input required type="text" ng-model="title"&gt;
          &lt;button type="submit"&gt;New Questionnaire&lt;/button&gt;
      &lt;/form&gt;
  
      &lt;div ng-repeat="qstnr in qstnrs"&gt;
          {{qstnr.title}} by {{qstnr.author}}&lt;br&gt;
          &lt;ul ng-repeat="question in qstnr.questions"&gt;
              &lt;li&gt;#{{question.qid}}: {{question.qtype}}&lt;/li&gt;
          &lt;/ul&gt;
          &lt;!-- Form we're speaking about --&gt;
          &lt;form ng-submit="newQuestion($index)"&gt;
              &lt;input required type="text" ng-model="type"&gt;
              &lt;button type="submit"&gt;[+] Question&lt;/button&gt;
          &lt;/form&gt;
      &lt;/div&gt;
   &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>When we attempt to add a new question to a questionnaire, the type doesn't appear, or appears undefined.</p>
  
  <p>Why does this happen and how can I make it work?</p>