-
0 votesanswersviews
如何实现一个自定义验证器,它既可以在被动形式也可以在模板驱动的形式下工作?
我有一个简单的反应形式: home.component.html <div class="jumbotron"> <h2>Form with Validations</h2> <form novalidate [formGroup]="complexForm" (ngSubmit)="submitF... -
1 votesanswersviews
Angular Forms反应 - 交叉控制验证
我正在使用角度为5的反应形式的验证器,并且难以设置基于另一个输入的值的验证器 . 表单看起来像这样: let myRules = new FormArray([]); myRules.push(this.newRuleFormGroup(1, 'period', 1)); this.myForm = new FormGroup({ 'name': new FormControl(na... -
9 votesanswersviews
使用mat-error显示自定义验证器错误
我来找你谈论角材料的问题 . 事实上,我认为这是一个问题,但我更喜欢先寻找误解 . 关于我的问题的第一件事是上下文,我尝试做一个包含两个输入的简单表单:密码及其'确认 . user-form.component.ts this.newUserForm = this.fb.group({ type: ['', Validators.required], firstname: ['', Val... -
32 votesanswersviews
在Laravel 5中使用表单请求验证时如何添加自定义验证规则
我正在使用表单请求验证方法来验证laravel 5中的请求 . 我想用表单请求验证方法添加我自己的验证规则 . 我的请求类在下面给出 . 我想添加自定义验证numeric_array和字段项 . protected $rules = [ 'shipping_country' => ['max:60'], 'items' => ['array|numericarr... -
1 votesanswersviews
反应形式的多个自定义验证器角度2
我在 reactive form 中有两个自定义 validator ,我在下面调用函数在组件构造函数中创建表单: private createForm(): void { this.passwordUpdateForm = this.formBuilder.group({ newpassword : [null, Validators.required], passwordcon... -
0 votesanswersviews
将表单控件值传递给自定义验证器角度反应形式
有一个自定义验证器,它将一个值作为参数,并检查所属的控制值是否等于该参数值 . 表单是 reactive form ,应检查的值是表单中的现有控件值(fisrstname,lastname和email) . 问题是,当创建表单时,没有任何控件(fisrstname,lastname和email)具有值,因此null将被发送到验证函数,然后验证不起作用,应如何处理这种情况?我在考虑 custom a... -
2 votesanswersviews
Angular 5:找不到模块:错误:可以't resolve ' @ angular / forms / src / validators'
我正在尝试使用指令创建自定义验证程序,但得到以下错误 . ERROR in ./src/app/CustomValidators/white-space-validator.directive.ts Module not found: Error: Can't resolve '@angular/forms/src/validators' in 'D:\Angular\Admin\src\app\...