我升级到 rc.4 并尝试使用新的 forms-api。这就是我得到的:
“TypeError:this.form.updateValueAndValidity 不是函数”
异常源自 Angular 中的文件“form_group_directive.js”:
FormGroupDirective.prototype.ngOnChanges = function (changes) {
this._checkFormPresent();
if (collection_1.StringMapWrapper.contains(changes, 'form')) {
var sync = shared_1.composeValidators(this._validators);
this.form.validator = validators_1.Validators.compose([this.form.validator, sync]);
var async = shared_1.composeAsyncValidators(this._asyncValidators);
console.log('from within angular:---------------------------------------------------------------------------------------------------');
console.log(this.form);
this.form.asyncValidator = validators_1.Validators.composeAsync([this.form.asyncValidator, async]);
this.form.updateValueAndValidity({ onlySelf: true, emitEvent: false });
}
console.log-statement 的输出是一个FormGroupDirective
没有名为 的方法updateValueAndValidity
。
上述错误消息对任何人都意味着什么?