當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。