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


TypeScript Validators.maxLength方法代码示例

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


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

示例1: 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

示例2: _applyValidators

 private _applyValidators() {
     this.form = this._formBuilder.group({
         email: [this.model.email, Validators.compose([
             Validators.required,
             Validators.maxLength(255),
             CtValidators.email,
         ])],
         password: [this.model.password, Validators.compose([
             Validators.required,
             Validators.minLength(6),
             Validators.maxLength(255),
         ])],
     })
 }
开发者ID:matheusmariano,项目名称:colonthree-webapp,代码行数:14,代码来源:login-form.component.ts

示例3: get

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

示例4: initValidators

 private initValidators():void {
     console.log('Adding validators to control ',this.name);
     let validators:Array<Function> = [];
     if(this.required) {
         validators.push(Validators.required);
     }
     if(this.isTypeText() && this.minLength) {
         console.log('Adding minLength validator',this.minLength);
         validators.push(Validators.minLength(this.minLength));
     }
     if(this.isTypeText() && this.maxLength) {
         console.log('Adding maxLength validator',this.maxLength);
         validators.push(Validators.maxLength(this.maxLength));
     }
     if(this.isTypeEmail()) {
         validators.push(ValidatorService.emailValidator);
     }
     if(this.isTypeNumber()) {
         validators.push(ValidatorService.numberValidator);
     }
     if(this.isInput() && this.pattern) {
         validators.push(ValidatorService.regexValidator(this.pattern));
     }
     console.log(validators.length+' validators added to control',this.name);
     this.validators = Validators.compose(validators);
 }
开发者ID:kamfasage,项目名称:angular-spring-dynamic-form,代码行数:26,代码来源:form.ts

示例5: constructor

 constructor(fb: FormBuilder) {
   this.projectForm = fb.group({
     'clientName': ['', Validators.required],
     'description': ['Nuclear Missile Defense System', Validators.compose([
       Validators.required,
       Validators.maxLength(30)
     ])],
     'clientEmail': ['', Validators.compose([
       MdPatternValidator.inline('^.+@.+\..+$'),
       Validators.required,
       Validators.minLength(10),
       Validators.maxLength(100)
     ])],
     'rate': [500, Validators.compose([
       MdNumberRequiredValidator.inline(),
       MdPatternValidator.inline('^1234$'),
       MdMinValueValidator.inline(800),
       MdMaxValueValidator.inline(4999)
     ])]
   });
 }
开发者ID:790,项目名称:ng2-material,代码行数:21,代码来源:form_builder.ts

示例6: constructor

 constructor(private _verify:VerifyService,
             private _router:Router,
             private _formBuilder:FormBuilder) {
   this.token = new Control('', Validators.compose([
     Validators.required,
     Validators.minLength(8),
     Validators.maxLength(8)
   ]));
   this.verifyEmailForm = _formBuilder.group({
     token: this.token
   })
 }
开发者ID:G-MontaG,项目名称:Chat,代码行数:12,代码来源:verify.component.ts

示例7: constructor

  constructor(private userService : UserService,
              private fb: FormBuilder,
              private nav: NavController,
              private navParams: NavParams) {
    // If we navigated to this page, we will have an item available as a nav param
    this.nav = nav;

    this.smsverifycode =
       new Control("",Validators.compose([Validators.required, Validators.maxLength(4), Validators.minLength(4)]));

    this.form = fb.group({
       smsverifycode:  this.smsverifycode
    });
  }
开发者ID:maksengc,项目名称:dxChange,代码行数:14,代码来源:activation.ts

示例8: constructor

 constructor(
 	fb: FormBuilder,
 	public authService: AuthService,
   public nav: NavController) {
 	this.signinForm = fb.group({
 		'email': ['', Validators.compose([
 			Validators.minLength(3),
 			Validators.maxLength(30),
 			Validators.required,
 			emailValidator
 			])],
 		'password': ['', Validators.required]
 	})
 	this.email = this.signinForm.controls['email']
 	this.password = this.signinForm.controls['password']
 }
开发者ID:billgate,项目名称:jackblog-ionic2,代码行数:16,代码来源:login.ts

示例9: constructor

 constructor(private _router:Router,
             private _loginService:LoginService,
             private _formBuilder:FormBuilder) {
   this.email = new Control('', Validators.compose([
     Validators.required,
     Validators.minLength(8),
     FormValidationService.isEmail
   ]));
   this.password = new Control('', Validators.compose([
     Validators.required,
     Validators.minLength(8),
     Validators.maxLength(30),
     FormValidationService.isPassword
   ]));
   this.loginForm = _formBuilder.group({
     email: this.email,
     password: this.password
   });
 }
开发者ID:G-MontaG,项目名称:Chat,代码行数:19,代码来源:login.component.ts

示例10: constructor

  constructor(public nav: NavController, public fb: FormBuilder) {
    this.recipeForm = fb.group({
      "name": ["", Validators.compose([Validators.required, Validators.minLength(3)])],
      "description": ["", Validators.compose([Validators.required, Validators.maxLength(140)])],
      "prepTime": ["", Validators.compose([Validators.pattern("^[0-9]*$")])],
      "cookingTime": ["", Validators.compose([Validators.required, Validators.pattern("^[0-9]*$")])],
      "ingredient1": ["", Validators.compose([Validators.required])],
      "direction1": ["", Validators.compose([Validators.required])]
    });

    this.ingredients = [];

    this.name = this.recipeForm.controls["name"];
    this.description = this.recipeForm.controls["description"];
    this.prepTime = this.recipeForm.controls["prepTime"];
    this.cookingTime = this.recipeForm.controls["cookingTime"];
    this.ingredients = [
      this.recipeForm.controls["ingredient1"]
      ];
    this.directions = [
      this.recipeForm.controls["direction1"]
    ];
  }
开发者ID:vihanchaudhry,项目名称:pocket-recipes,代码行数:23,代码来源:new-recipe.ts


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