title: I am losing my definition of a form controller when the controller is set in an ng-repeat
body: <p>I have code that uses AngularJS v1.5.0 and creates multiple forms with an ng-repeat like this. Note that inside the form I show the form details between xx and xx:</p>
  
  <pre><code>&lt;div ng-click="wos.wordFormRowClicked(wf)"
       ng-form="wos.wordFormNgForm_{{wf.wordFormId}}"
       ng-repeat="wf in wos.word.wordForms"&gt;
  
       xx {{ wos['wordFormNgForm_1465657579'] }}  xx
  </code></pre>
  
  <p>When the runs I am able to see the form details appear between the xx and xx and I am able to query the state of the form like this:</p>
  
  <pre><code>wordFormCheckAndUpdate = (): ng.IPromise&lt;any&gt; =&gt; {
      var self = this;
      var wordFormNgForm = 'wordFormNgForm_' + wf.wordFormId;
      self[wordFormNgForm].$setDirty();
  </code></pre>
  
  <p>However in my code after calling this procedure the form becomes undefined and also nothing shows between the xx and xx. As I step through this procedure with the debugger the last line I see is the line setting the value of a and then as soon as the function finishes the information between the xx and xx disappears and the form becomes undefined:</p>
  
  <pre><code>wordEditSubmit = (): ng.IPromise&lt;any&gt; =&gt; {
      var self = this;
      return this.wordFormCheckAndUpdate().then(
          () =&gt; {
              return self.$http({
                  url: self.ac.dataServer + "/api/word/Put",
                  method: "PUT",
                  data: self.word
              })
                  .then(
                  (response: ng.IHttpPromiseCallbackArg&lt;IWordRow&gt;): any =&gt; {
                      self.word = angular.copy(response.data);
                      self['wordNgForm'].$setPristine();
                      self.uts.remove(self.words, 'wordId', self.word.wordId);
                      response.data.current = true;
                      self.words.push(response.data);
                      var a = 99;
                  },
                  (error: ng.IHttpPromiseCallbackArg&lt;any&gt;): any =&gt; {
                      self.ers.error(error);
                      return self.$q.reject(error);
                  });
          }
      );
  }
  </code></pre>
  
  <p>My problem is that if I then try to repeat this:</p>
  
  <pre><code>setDirty = (): ng.IPromise&lt;any&gt; =&gt; {
      var self = this;
      var wordFormNgForm = 'wordFormNgForm_' + wf.wordFormId;
      self[wordFormNgForm].$setDirty();
  }
  </code></pre>
  
  <p>then the controller object <code>self[wordFormNgForm]</code> is no longer defined. </p>
  
  <p>For reference.  Here is how new wordForms are created:</p>
  
  <pre><code>wordFormAdd = () =&gt; {
      this.wordFormId = Math.floor(Date.now() / 1000);
      var emptyWordForm: IWordForm = &lt;IWordForm&gt;{
          wordId: this.word.wordId,
          wordFormId: this.wordFormId,
          posId: 1,
          statusId: Status.New
      };
      this.word.wordForms.push(emptyWordForm);
      this.wordNgForm.$setDirty();
  }
  </code></pre>
  
  <p>Here is the remove function:</p>
  
  <pre><code>remove = (arr, property, num) =&gt; {
      arr.forEach((elem, index) =&gt; {
          if (elem[property] === num)
              arr.splice(index, 1);
      })
  };
  </code></pre>
  
  <p>Does anyone have any advice as to how I could solve this problem</p>