当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Validators.minLength方法代码示例

本文整理汇总了TypeScript中angular2/common.Validators.minLength方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Validators.minLength方法的具体用法?TypeScript Validators.minLength怎么用?TypeScript Validators.minLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在angular2/common.Validators的用法示例。


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

示例1: constructor

 constructor(fb: FormBuilder) {
     this.form = fb.group({
         currentPassword: [
             '',
             Validators.compose([
                 Validators.required
                 
             ]),
             // Validators.composeAsync([
             //     PasswordValidators.shouldBeValid
             // ])
             
         ],
         newPassword: [
             '',
             Validators.compose([
                 Validators.required,
                 Validators.minLength(5)
             ])                
         ],
         newPassword1: [
             '',
             Validators.compose([
                 Validators.required,
                 Validators.minLength(5)
             ])                
         ]
         
     }, {validator: PasswordValidators.twoPasswordsShouldBeMatched})
 }
开发者ID:mick703,项目名称:angular2-sandbox,代码行数:30,代码来源:update-password-form.component.ts

示例2: constructor

	constructor(
		fb: FormBuilder,
		private _router: Router,
		public globalValService:GlobalValService,
		public authService: AuthService) {
		this.signinForm = fb.group({
			'email': ['', Validators.compose([
				Validators.minLength(3),
				Validators.maxLength(30),
				Validators.required,
				emailValidator
				])],
			'password': ['', Validators.required],
			'captcha': ['', Validators.compose([
				Validators.minLength(6),
				Validators.maxLength(6),
				Validators.required
			])]
		})
		this.email = this.signinForm.controls['email']
		this.password = this.signinForm.controls['password']
		this.captcha = this.signinForm.controls['captcha']
		this.globalValService.captchaUrlSubject.subscribe((captchaUrl:string) => {
			this.captchaUrl = captchaUrl
		})
		this.authService.snsLoginsSubject.subscribe((logins:string[])=>{
			this.logins = logins
		})
	}
开发者ID:KennyLisc,项目名称:jackblog-angular2,代码行数:29,代码来源:index.ts

示例3: constructor

    constructor(
        formBuilder: FormBuilder,
        private _notificationService: NotificationsService
    ) {
        this.regForm = formBuilder.group({
            'name': ['', Validators.compose([Validators.required, Validators.minLength(3), Validators.maxLength(20), Validators.pattern('^[a-zA-Z ]+$')])],
            'email': ['', Validators.compose([Validators.required, Validators.pattern('[0-9a-zA-Z_.-]+[@]+[a-zA-Z]+[.]+[a-zA-Z]{2,5}$')])],
            'password': ['', Validators.compose([Validators.required, Validators.minLength(8), Validators.maxLength(1000), hasUpper, hasLower, hasDigit, hasSpecial])],
            'employer': ['', Validators.pattern('^[a-zA-Z0-9 .]+$')],
            'position': ['', Validators.pattern('^[a-zA-Z0-9 .]+$')],
            'fruit': ['', Validators.pattern('^[a-zA-Z ]+$')],
            'num': ['', Validators.pattern('^[0-9]+$')],
            'year': ['', Validators.pattern('^([0-9]|[0-9][0-9]|[0-9][0-9][0-9]|[1][0-9][0-9][0-9]|[2][0][0][0-9]|[2][0][1][0-6])$')],
            'throne': ['', Validators.pattern('^[a-zA-Z0-9!._-]+[@]+[a-zA-Z.]+$')],
        });

        this.reqChecks = [
            {name: 'name', value: this.regForm.find('name').valid},
            {name: 'email', value: this.regForm.find('email').valid},
            {name: 'password', value: this.regForm.find('password').valid}
        ];

        this.optChecks = [
            {name: 'employer', value: this.regForm.find('employer').valid},
            {name: 'position', value: this.regForm.find('position').valid},
            {name: 'fruit', value: this.regForm.find('fruit').valid},
            {name: 'num', value: this.regForm.find('num').valid},
            {name: 'year', value: this.regForm.find('year').valid},
            {name: 'throne', value: this.regForm.find('throne').valid}
        ]
    }
开发者ID:flauc,项目名称:udacityMeetUpAngular2,代码行数:31,代码来源:reg.component.ts

示例4: constructor

    constructor(private nav: NavController, fb: FormBuilder) {
        this.loginForm = fb.group({
            username: ["", Validators.required, Validators.minLength(4), this.checkFirstCharacterValidator],
            password: ["", Validators.required, Validators.minLength(6), this.checkFirstCharacterValidator]
        });
        //console.log(this.loginForm.controls, this.loginForm, this.loginForm instanceof ControlGroup);
        this.usernameCtrl = this.loginForm.controls['username'];
        this.passwordCtrl = this.loginForm.controls['password'];

        /**
         * 监测form变化,ControlGroup和Control均可使用此方式
         */
        this.loginForm.valueChanges.subscribe(form => {
            console.log('form changes to ', form);
        });

        this.usernameCtrl.valueChanges.subscribe(value => {
            console.log('username changes to ', value);
        });

        this.passwordCtrl.valueChanges.subscribe(value => {
            console.log('password changes to ', value);
        });

    }
开发者ID:liuwenzhuang,项目名称:ionic2-quickstart-ts,代码行数:25,代码来源:login.ts

示例5: constructor

  constructor(private fb: FormBuilder, private translate: TranslateService) {
    this.translate = translate;
    this.authForm = fb.group({
      'username': ['', Validators.compose([Validators.required, Validators.minLength(8), this.checkFirstCharacterValidator])],
      'password': ['', Validators.compose([Validators.required, Validators.minLength(8), this.checkFirstCharacterValidator])]
    });

    this.username = this.authForm.controls['username'];
    this.password = this.authForm.controls['password'];
  }
开发者ID:quanganh206,项目名称:ionic2-kitchen-sink-ts,代码行数:10,代码来源:login.ts

示例6: constructor

  constructor(public nav: NavController,
              public fb: FormBuilder) 
    {
       this.authForm = fb.group({  
            'username': ['', Validators.compose([Validators.required, Validators.minLength(8)])],
            'password': ['', Validators.compose([Validators.required, Validators.minLength(8)])]
        });
 
        this.username = this.authForm.controls['username'];     
        this.password = this.authForm.controls['password'];   
    }
开发者ID:android-sos,项目名称:Ionic2Pokedex,代码行数:11,代码来源:login.ts

示例7: constructor

 constructor(private nav: NavController, private firebaseService: FirebaseService, fb: FormBuilder) {
   this.minEmailLen = 4;
   this.maxEmailLen = 30;
   this.minPasswordLen = 6;
   this.maxPasswordLen = 20;
   this.submitButtonText = "Login";
   this.isAuthOngoing = false;
   this.authForm = fb.group({
     'email' : ['', Validators.compose([Validators.required, Validators.minLength(this.minEmailLen), Validators.maxLength(this.maxEmailLen)])],
     'password': ['', Validators.compose([Validators.required, Validators.minLength(this.minPasswordLen), Validators.maxLength(this.maxPasswordLen)])]
   });
   this.email = this.authForm.controls['email'];
   this.password = this.authForm.controls['password'];
 }
开发者ID:isvicbhasme,项目名称:greeter,代码行数:14,代码来源:login.ts

示例8: constructor

 constructor(builder: FormBuilder) {
   
   this.email = new Control('', 
     Validators.compose([Validators.required, CustomValidators.emailFormat]),
     CustomValidators.duplicated
   );
   
   this.password = new Control('',
     Validators.compose([Validators.required, Validators.minLength(4)])
   );
   
   this.group = builder.group({
     email: this.email,
     password: this.password
   });
   
   this.email.valueChanges.subscribe((value: string) => {
     this.emailValue = value;
   });
   this.password.valueChanges.subscribe((value: string) => {
     this.passwordValue =value;
   });
   this.group.valueChanges.subscribe((value: any) => {
     this.groupValue = value;
   });
 }
开发者ID:Hachero,项目名称:ngCourse2,代码行数:26,代码来源:my-form.component.ts

示例9: get

 static get(): Control {
     return new Control('', Validators.compose([
         Validators.required,
         Validators.minLength(8),
         PhoneValidator.mailFormat 
     ]));
 }
开发者ID:felipedasilva,项目名称:openjobs,代码行数:7,代码来源:phone.validator.ts

示例10: constructor

 constructor(private _authService: AuthService, fb: FormBuilder) {
   this.registerForm = fb.group({
     email: ['', Validators.required],
     password: ['', Validators.compose([Validators.required, Validators.minLength(8)])],
     password_confirmation: ['', Validators.compose([Validators.required, Validators.minLength(8)])]
   }, {validator: this.matchingPasswords('password', 'password_confirmation')});
 }
开发者ID:victir,项目名称:todo-angular2-rails-api,代码行数:7,代码来源:registration.ts


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