當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Validators.compose方法代碼示例

本文整理匯總了TypeScript中angular2/common.Validators.compose方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Validators.compose方法的具體用法?TypeScript Validators.compose怎麽用?TypeScript Validators.compose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在angular2/common.Validators的用法示例。


在下文中一共展示了Validators.compose方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: constructor

 constructor(public nav: NavController, fb: FormBuilder) {
   this.nav = nav;
   this.memberForm = fb.group({
     fullname: ["",Validators.required],
     username: ["",Validators.required],
     //password: ["",Validators.required]
     password: ["",Validators.compose([Validators.required,Validators.minLength(8)])] // required password 8 charactor
   });
 }
開發者ID:bameeman,項目名稱:MyFirstApp,代碼行數:9,代碼來源:user.ts

示例2: constructor

 constructor(fb: FormBuilder, public addressService: Addresses, private router: Router) {
     this.editAddressForm = fb.group({
         'mail': ['', Validators.compose([
             Validators.required, mailValidator])],
         'firstName': ['', Validators.required],
         'lastName': ['', Validators.required],
         'country': ['', Validators.required]
     });
 }
開發者ID:szymon-wiatr,項目名稱:angular2-address-book,代碼行數:9,代碼來源:index.async.ts

示例3: constructor

 constructor(fb:FormBuilder) {
     this.form = fb.group({
         username: ['', Validators.compose([
             Validators.required,
             UsernameValidators.cannotContainSpace
         ]), UsernameValidators.shouldBeUnique], // shouldBeUnique is an async validator
         password: ['', Validators.required]
     });
 }
開發者ID:toefel18,項目名稱:angular2-exercises,代碼行數:9,代碼來源:signup-form.component.ts

示例4: constructor

  constructor(signupform: FormBuilder, private _http: Http, private httpservice: HttpService, private _router: Router) {

      this.SignupForm  = signupform.group({
          "username": ["", Validators.compose([Validators.required, CustomFromValidation.isStartWithNumber])],
          "firstname": ["", Validators.compose([Validators.required, CustomFromValidation.isStartWithNumber])],
          "lastname": ["", Validators.compose([Validators.required, CustomFromValidation.isStartWithNumber])],
          "email": ["",  Validators.compose([Validators.required, CustomFromValidation.EmailValidation])],
          "password": ["", Validators.compose([Validators.required, Validators.minLength(3)])],
          "confirmPassword": ["", Validators.required]
      });
      this.username = this.SignupForm.controls["username"];
      this.firstname = this.SignupForm.controls["firstname"];
      this.lastname = this.SignupForm.controls["lastname"];
      this.email = this.SignupForm.controls["email"];
      this.password = this.SignupForm.controls["password"];
      this.confirmPassword = this.SignupForm.controls["confirmPassword"];

  }
開發者ID:MOHAMMADArsalan,項目名稱:SalemanApp_ng02,代碼行數:18,代碼來源:signup.component.ts

示例5: constructor

	constructor(fb: FormBuilder){
		this.form = fb.group({
			username: ['',Validators.compose([
					Validators.required,
					UsernameValidators.cannotContainSpace
			])],
			password: ['',Validators.required]
		})
	}
開發者ID:krjijeesh88,項目名稱:ang2,代碼行數:9,代碼來源:signup-form.component.ts

示例6: constructor

 constructor(fb: FormBuilder){
     this.form = fb.group({
         username:['',Validators.compose([
             Validators.required, 
             UsernameValidators.cannotContainSpace
             ]), UsernameValidators.shouldBeUnique], //this array can take 3 params: default value, 1 or more custom synchronous validators, 1 or more async validators
         password:['',Validators.required]
     })
 }
開發者ID:mderfler,項目名稱:advanced-forms-example,代碼行數:9,代碼來源:signup-form.component.ts

示例7: ngOnInit

 ngOnInit(){
     this.myForm = this._fb.group({
         email: ['',Validators.compose([
             Validators.required,
             this.isEmail
         ])],
         password: ['',Validators.required]
     });
 }
開發者ID:biharck,項目名稱:udemy-node-angular2,代碼行數:9,代碼來源:signin-component.ts

示例8: constructor

 constructor(fb:FormBuilder,private _router:Router){
   this.form = fb.group({
     username:['',Validators.compose([
       Validators.required,
       UsernameValidators.cannotContainSpace]
     ),UsernameValidators.shoudBeUnique],
     password:['',Validators.required]
   })
 }
開發者ID:kamiranoff,項目名稱:angular2,代碼行數:9,代碼來源:complex-form.component.ts

示例9: constructor

  constructor(app: IonicApp, nav: NavController, dbService: DBService, fb: FormBuilder, userService: UserService) {

    this.dbService = dbService;
    this.userService = userService;
    this.app = app;
    this.nav = nav;
    this.form = fb.group({
      matchingPassword: fb.group({
        password: ['', Validators.required],
        passwordConfirm: ['', Validators.required]
      }, { validator: this.areEqual }),
      email: new Control('', Validators.compose([Validators.required, this.isEmail])),
      firstName: new Control('', Validators.required),
      lastName: new Control('', Validators.required),
      mobile: new Control('', Validators.compose([Validators.required, this.isPhoneNumber]))
    });
    this.signupData = {};
  }
開發者ID:marcelpetersen,項目名稱:football-planer,代碼行數:18,代碼來源:signup.ts

示例10: constructor

 constructor(fb: FormBuilder) {
     this.skuForm = fb.group({
         'sku': ['',
                 Validators.compose([
                     Validators.required,
                     skuValidator
                 ])]
     });
 }
開發者ID:kencbarrett,項目名稱:angular2-forms,代碼行數:9,代碼來源:demo-form-with-custom-validations.ts


注:本文中的angular2/common.Validators.compose方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。