所以现在除了验证模块之外,我还使用Angular6 Reactive form模块创建表单。
form = new FormGroup({
groupOne: new FormGroup({
example: new FormControl('', Validation.required)
})
})
当然,这是一个非常基本的实现,但当验证方法开始堆叠时,尤其是在大型表单上,这会变得非常冗长,有没有更谨慎的方法来处理这个问题,即将验证/规则与控制器解耦?
干杯。
我工作的角度反应形式验证,在那里,我无法验证电子邮件。
每输入一次电子邮件,我都会出错-
ReactiveComponent.html:21 ERROR Error: Expected validator to return Promise or Observable.
at toObservable (forms.js:456)
at Array.map (<anonymous>)
at FormControl.asyncValidator (forms.js:444)
at FormControl.push../node_modules/@ang
我使用的是角2rc 5,下面是:
埃斯下
webpack
反应形式
我已经构建了一个简单的测试表单,并在浏览器控制台中得到以下错误:
zone.js:461Unhandled Promise rejection: EXCEPTION: Error in ./FormComponent class FormComponent - inline template:4:25
ORIGINAL EXCEPTION: TypeError: this.form.get is not a function
ORIGINAL STACKTRACE:
TypeError: this.form
I have a list of form controls in a reactive form angular
this.myForm = this.fb.group({
firstName: [''],
lastName: [''],
stage: [''])}
我在表单顶部有一个单选按钮,按字母顺序对字段排序。如何实现此功能。
任何帮助都是非常感谢的。
我在Plunkr上有一个角2 RC4基本表单示例,它似乎会抛出以下错误(在Chrome控制台中)
这是柱塞
错误:
browser_adapter.ts:82 EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in ./App class App - inline template:1:7
ORIGINAL EXCEPTION: formGroup expects a FormGroup instance. Please pass one in.
Example: <form [formGroup]
所以,我从angular reactive表单发送数据,比如:Angular reactive form UI image 和Data being sent to backend in browser console image 我已经为任务创建了模式,如下所示: const mongoose = require('mongoose');
const Schema = mongoose.Schema;
let taskSchema = new Schema({
taskId:{
type:String,
unique:true
因此,我正在尝试将我的表单从RC1升级到RC3。我已经在我认为合适的地方做了一些改变。然而,我仍然收到以下错误:
There is no directive with "exportAs" set to "ngForm" (" <input id="language" type="text" [(ngModel)]="language.strName" formControlName="language" [ERROR ->]#language="ngF