<!--大多数情况下,Angular会把模板引用变量的值设置为声明它的那个元素。 -->
<!--在上一个例子中,phone引用的是表示电话号码的<input>框。 -->
<!--不过,指令也可以修改这种行为,让这个值引用到别处,比如它自身。 NgForm指令就是这么做的。-->
<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>
<input #phone placeholder="phone number">
<!-- lots of other elements -->
<!-- phone refers to the input element; pass its `value` to an event handler -->
<button (click)="callPhone(phone.value)">Call</button>