我升级了我的项目,我的验证器不再工作了。
我的验证员:
import {AnoMesCcValidator} from '../../validators/index';
this.formCartaoDeCredito = new FormGroup({
anoMesCartaoDeCreditoControl: new FormControl('anoMesCartaoDeCreditoControl', [Validators.required])
});
我的打字稿
<form [formGroup]="formCartaoDeCredito" role="form">
<div class="row">
<div class="col-xs-7 col-md-7">
<div class="form-group">
<label for="cardExpiry"><span class="hidden-xs">Vencimento</span><span class="visible-xs-inline">EXP</span></label>
<input class="form-control"
placeholder="MM / YYYY"
autocomplete="cc-exp"
onkeyup="formataMesAno(event)"
maxlength="7"
ano-mes-cc-validator
formControlName="anoMesCartaoDeCreditoControl"
[(ngModel)]="cartaoCredito.Validade" />
</div>
</div>
我的模板:
p => p.Age
所以,不起作用,错误是“无法读取属性&#39;有效&#39;未定义&#39;,我已经设置#anoMesCartaoDeCreditoControl