• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript ng2-validation.CustomValidators类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中ng2-validation.CustomValidators的典型用法代码示例。如果您正苦于以下问题:TypeScript CustomValidators类的具体用法?TypeScript CustomValidators怎么用?TypeScript CustomValidators使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CustomValidators类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: constructor

    constructor(
        formBuilder: FormBuilder,
        private router: Router,
        private authService: AuthService,
        private jwtService: JwtService,
        private userService: UserService
    ) {
        super();

        const password = new FormControl('', [
            Validators.required,
            Validators.minLength(6)
        ]);

        this.form = formBuilder.group({
            username: ['', [
                Validators.required,
                Validators.minLength(2)
            ]],
            plainPassword: formBuilder.group({
                first: password,
                second: ['', [
                    Validators.required,
                    CustomValidators.equalTo(password)
                ]]
            })
        });
    }
开发者ID:Invis1ble,项目名称:assistant-client,代码行数:28,代码来源:registration.component.ts


示例2: constructor

 constructor(private router: Router,
     private userService: UserService,
     private toastyService: ToastyService) {
     this.form = new FormGroup({
         username: new FormControl('', CustomValidators.range([5, 9])),
         password: new FormControl('', CustomValidators.number)
     });
 }
开发者ID:luoqg,项目名称:wikift,代码行数:8,代码来源:user.register.component.ts


示例3: ngOnInit

 ngOnInit(): void {
     this.form = this.formBuilder.group({
         name: [this.category.name, Validators.required],
         description: [this.category.description],
         rate: [this.category.rate, [
             Validators.required,
             CustomValidators.number,
             CustomValidators.min(5)
         ]]
     });
 }
开发者ID:Invis1ble,项目名称:assistant-client,代码行数:11,代码来源:category-form.component.ts


示例4: ngOnInit

 ngOnInit(): void {
     this.form = this.formBuilder.group({
         category: [this.category.id, Validators.required],
         title: [this.task.title, Validators.required],
         description: [this.task.description],
         rate: [this.task.rate, [
             Validators.required,
             CustomValidators.number,
             CustomValidators.min(5)
         ]]
     });
 }
开发者ID:Invis1ble,项目名称:assistant-client,代码行数:12,代码来源:task-form.component.ts


示例5: constructor

    constructor(public settings: SettingsService, fb: FormBuilder) {

        let password = new FormControl('', Validators.compose([Validators.required, Validators.pattern('^[a-zA-Z0-9]{6,10}$')]));
        let certainPassword = new FormControl('', [Validators.required, CustomValidators.equalTo(password)]);

        this.passwordForm = fb.group({
            'password': password,
            'confirmPassword': certainPassword
        });

        this.valForm = fb.group({
            'email': [null, Validators.compose([Validators.required, CustomValidators.email])],
            'accountagreed': [null, Validators.required],
            'passwordGroup': this.passwordForm
        });
    }
开发者ID:echolaw,项目名称:work-day,代码行数:16,代码来源:register.component.ts


示例6: FormControl

import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
import { CustomValidators } from 'ng2-validation';

const password = new FormControl('', Validators.required);
const confirmPassword = new FormControl('', CustomValidators.equalTo(password));

@Component({
  selector: 'app-signup',
  templateUrl: './signup.component.html',
  styleUrls: ['./signup.component.scss']
})
export class SignupComponent implements OnInit {

  public form: FormGroup;
  constructor(private fb: FormBuilder, private router: Router) { }

  ngOnInit() {
    this.form = this.fb.group({
      uname: [null, Validators.compose([Validators.required])],
      password: password,
      confirmPassword: confirmPassword
    });
  }

  onSubmit() {

    this.router.navigate(['/']);
  }
开发者ID:bhavdip13,项目名称:Angular5_core2.1_EfCore,代码行数:30,代码来源:signup.component.ts



注:本文中的ng2-validation.CustomValidators类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript ng2-webstorage.LocalStorageService类代码示例发布时间:2022-05-25
下一篇:
TypeScript ng2-ui-auth.JwtHttp类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap