angular - TypeError:'this.validator is not a function' on complete not releated error callback
问题描述
这是堆栈跟踪:
TypeError: this.validator is not a function app.component.ts:35
at FormControl.AbstractControl._runValidator (forms.es5.js:2720)
at FormControl.AbstractControl.updateValueAndValidity (forms.es5.js:2688)
at new FormControl (forms.es5.js:3011)
at FormBuilder.control (forms.es5.js:5863)
at FormBuilder._createControl (forms.es5.js:5905)
at eval (forms.es5.js:5887)
at Array.forEach (<anonymous>)
at FormBuilder._reduceControls (forms.es5.js:5886)
at FormBuilder.group (forms.es5.js:5845)
at ProfileSettingsComponent.init (profile-settings.component.ts:318)
打开用户设置页面时出现此错误。正如您在 profile-settings.componenet.ts 中第 318 行的堆栈跟踪中看到的那样,只有 FormBuilder 的第一行。而且我无法理解 FormBuilder 和在 app.componenet.ts 中获取用户对象之间的关系是什么。
app.component.ts:
this.sub = this.userService.getLoggedUser()
.subscribe(res => {
console.info('From app: ', res.body.user);
this.loadVideoChatInviter = true;
}, err => {
console.error(err); // line 35
});
配置文件设置.component.ts:
this.userSettingsToUpdate = this.fb.group({ // line 318
'firstName': this.user.firstName,
'lastName': this.user.lastName,
'email': this.user.email,
'gender': this.genderItems,
// ...
'newPassword': ['', Validators.minLength(6)],
'confirmedPassword': ['', Validators.minLength(6)],
// ...
});
解决方案
推荐阅读
- c# - C# - 用白色字节填充图像字节以填充 512 x 512
- react-router - 如何使用以相同字符串开头的路由
- python - Django:使用 .on_delete(SET_NULL) 级联,如何同时更改其他属性
- c# - 为什么创建迁移时,UP 和 DOWN 方法显示为空?
- c# - C#防止更新记录到数据库中存在的另一条记录
- r - 在 R Shiny 中单独计算和绘图
- c - 从 C 中读取文件时如何使用指针填充结构数组
- c# - 如何从 botframework v3 c# 发送事件并使用 Direct Line 在客户端 JavaScript 监听?
- django - 仅在提供时如何覆盖create方法中的字段
- wordpress - WP_Query posts_per_page 不适用于分页 1