我正在使用updateProfile(): void {
this.updateProfileForm.markAsPending(); // <------- SET AS PENDING
const formData = {
username: this.updateProfileForm.value.username,
email: this.updateProfileForm.value.email
};
this.us.editProfile(formData)
.first()
.subscribe(
res => {
this.updateProfileForm.markAsNOTPending(); // <------- SET AS NOT PENDING
},
err => {
this.updateProfileForm.setErrors({
formError: true
});
}
);
}
在表单提交数据时显示加载微调器,我希望contains
在完成后立即显示,如:
"ConditionExpression": "contains (owners, :ownersStr)",
"ExpressionAttributeValues": {
":ownersStr" : "2"
}
无论如何要实现它吗?
由于
答案 0 :(得分:1)
我认为markAsPending()
不是为此而做的,它是一个描述Validator
正在验证但尚未完成的状态。您可以查看PR以获得更多解释的实现。
答案 1 :(得分:-1)
我会设置错误。像下面的例子:
this.updateProfileForm.setErrors({'incorrect': true});
并删除它我会这样做
this.updateProfileForm.setErrors(null);