<div id="heroForm">
  <!-- #docregion -->
  <form (ngSubmit)="onSubmit(heroForm)" #heroForm="ngForm">
    <div class="form-group">
      <label for="name">Name
        <input class="form-control" name="name" required [(ngModel)]="hero.name">
      </label>
    </div>
    <button type="submit" [disabled]="!heroForm.form.valid">Submit</button>
  </form>
  <div [hidden]="!heroForm.form.valid">
    {{submitMessage}}
  </div>
  <!-- #enddocregion -->
</div>
