@ngdoc method
@name form.FormController#$removeControl
@param {object} control control object, either a {@link form.FormController} or an
{@link ngModel.NgModelController}

@description
Deregister a control from the form.

Input elements using ngModelController do this automatically when they are destroyed.

Note that only the removed control's validation state (`$errors`etc.) will be removed from the
form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
different from case to case. For example, removing the only `$dirty` control from a form may or
may not mean that the form is still `$dirty`.
function(control) {
    if (control.$name && this[control.$name] === control) {
      delete this[control.$name];
    }
    forEach(this.$pending, function(value, name) {
      // eslint-disable-next-line no-invalid-this
      this.$setValidity(name, null, control);
    }, this);
    forEach(this.$error, function(value, name) {
      // eslint-disable-next-line no-invalid-this
      this.$setValidity(name, null, control);
    }, this);
    forEach(this.$$success, function(value, name) {
      // eslint-disable-next-line no-invalid-this
      this.$setValidity(name, null, control);
    }, this);

    arrayRemove(this.$$controls, control);
    control.$$parentForm = nullFormCtrl;
  }