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


TypeScript Validators.compose方法代码示例

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


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

示例1: constructor

 constructor( 
   public navCtrl: NavController ,
   private _services: GlobalServices ,
   private _fb: FormBuilder ,
   private _loader: LoaderUtil,
   private _alert: AlertUtil,
   private _storage: StorageUtil,
   private _store: StoreUtil,
   private _userAction : UserAction,
   private _zone: NgZone,
   private _push: Push
 ) {
   this.EMAIL_REGEXP = "^[-a-z0-9~!$%^&*_=+}{\'?]+(\.[-a-z0-9~!$%^&*_=+}{\'?]+)*@([a-z0-9_][-a-z0-9_]*(\.[-a-z0-9_]+[a-z][a-z])|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(:[0-9]{1,5})?$"
   this.registerForm = this._fb.group({
     name: ['' , Validators.compose([Validators.required , Validators.maxLength(30), Validators.pattern('[a-zA-Z ]*')])],
     email: ['' , Validators.compose(
         [
           Validators.required , 
           Validators.pattern(this.EMAIL_REGEXP)
         ])
       ]
   })
   this.registerSuccess = false
   this.submitAttempt = false
   this.tryToAuth = true
 }
开发者ID:hivoova,项目名称:travelsafe-operator,代码行数:26,代码来源:register.ts

示例2: constructor

 constructor(private formBuilder: FormBuilder) {
     this.hireMe = this.formBuilder.group({
         'sender': new FormControl('', Validators.compose([Validators.required])),
         'sendermail': new FormControl('', Validators.compose([Validators.required])),
         'subject': new FormControl('', Validators.compose([Validators.required])),
     });
 }
开发者ID:cescoferraro,项目名称:portifolio,代码行数:7,代码来源:contact.component.ts

示例3: constructor

  constructor(private nav: NavController, private us: UserService, private events: Events, private fs: FirebaseService, toastCtrl: ToastController) {
    super(toastCtrl);
    this.user = UserService.getCurrentUser();
    if (this.user == null) {
      this.user = new User(null, null, null);
      this.user.photoURL = fs.auth.currentUser.photoURL;
      this.user.mail = fs.auth.currentUser.email;
      this.user.displayName = fs.auth.currentUser.displayName;
    }

    LogService.logMessage("ProfilePage constructor ", this.user);
    this.form = new FormGroup({
      mail: new FormControl(this.user.mail, Validators.compose([ValidationService.emailValidator])),
      displayName: new FormControl(this.user.displayName, Validators.compose([Validators.required, Validators.minLength(8)])),
      auto: new FormControl(this.user.auto),
      auto2: new FormControl(this.user.auto2),
      houseNumber: new FormControl(this.user.houseNumber),
      flatNumber: new FormControl(this.user.flatNumber, Validators.compose([Validators.required, ValidationService.digitalValidator])),
      mobile1: new FormControl(this.user.mobile1, Validators.compose([Validators.required, Validators.minLength(8)])),
      mobile2: new FormControl(this.user.mobile2),
      photoURL: new FormControl(this.user.photoURL)
    });

    this.displayName = this.form.controls['displayName'];
    this.auto = this.form.controls['auto'];
    this.auto2 = this.form.controls['auto2'];
    this.houseNumber = this.form.controls['houseNumber'];
    this.flatNumber = this.form.controls['flatNumber'];
    this.mail = this.form.controls['mail'];
    this.mobile1 = this.form.controls['mobile1'];
    this.mobile2 = this.form.controls['mobile2'];
    this.photoURL = this.form.controls['photoURL'];

  }
开发者ID:balynsky,项目名称:ionic2-neighbors,代码行数:34,代码来源:profile.page.ts

示例4: createValidators

 /**
  * Creates form validationdepending [ITdDynamicElementConfig] properties.
  */
 createValidators(config: ITdDynamicElementConfig): ValidatorFn {
   let validator: ValidatorFn;
   if (config.required) {
     validator = Validators.required;
   }
   if (config.max || config.max === 0) {
     validator = Validators.compose([validator, Validators.max(parseFloat(config.max))]);
   }
   if (config.min || config.min === 0) {
     validator = Validators.compose([validator, Validators.min(parseFloat(config.min))]);
   }
   if (config.maxLength || config.maxLength === 0) {
     validator = Validators.compose([validator, Validators.maxLength(parseFloat(config.maxLength))]);
   }
   if (config.minLength || config.minLength === 0) {
     validator = Validators.compose([validator, Validators.minLength(parseFloat(config.minLength))]);
   }
   // Add provided custom validators to the validator function
   if (config.validators) {
     config.validators.forEach((validatorConfig: ITdDynamicElementValidator) => {
       validator = Validators.compose([validator, validatorConfig.validator]);
     });
   }
   return validator;
 }
开发者ID:Teradata,项目名称:covalent,代码行数:28,代码来源:dynamic-forms.service.ts

示例5: getMetricAvailableActions

 //Metric Available Acions:
 getMetricAvailableActions (data ? : any) : any {
   let tableAvailableActions = [
   //Remove Action
     {'title': 'Remove', 'content' :
       {'type' : 'button','action' : 'RemoveAllSelected'}
     },
   //Change Property Action
     {'title': 'Change property', 'content' :
       {'type' : 'selector', 'action' : 'ChangeProperty', 'options' : [
         {'title' : 'DataSrcType', 'type':'boolean', 'options' : [
           'INTEGER','Integer32','Gauge32','UInteger32','Unsigned32','Counter32','Counter64','TimeTicks','BITS','ENUM','OCTETSTRING','OID','IpAddress','TIMETICKS','COUNTER32','COUNTER64','COUNTERXX','HWADDR','STRINGPARSER','STRINGEVAL','CONDITIONEVAL','BITSCHK'
           ]
         },
         {'title': 'Scale','type':'input', 'options':
           new FormGroup({
             formControl : new FormControl('', Validators.compose([Validators.required,ValidationService.floatValidator]))
           })
         },
         {'title': 'Shift','type':'input', 'options':
           new FormGroup({
             formControl : new FormControl('', Validators.compose([Validators.required,ValidationService.floatValidator]))
           })
         },
         {'title' : 'IsTag', 'type':'boolean', 'options' : [
           'true','false'
           ]
         }
       ]},
     }
   ];
   return tableAvailableActions;
 }
开发者ID:toni-moreno,项目名称:snmpcollector,代码行数:33,代码来源:table-available-actions.ts

示例6: constructor

  constructor(
    public formBuilder: FormBuilder,
    public navParams: NavParams,
    private apiProvider: ApiProvider,
    private logger: Logger,
    private priceProvider: PriceProvider,
    private currencyProvider: CurrencyProvider
  ) {
    const chain: string = navParams.get('chain');
    const network: string = navParams.get('network');

    this.chainNetwork = {
      chain,
      network
    };
    this.apiProvider.changeNetwork(this.chainNetwork);
    this.currencyProvider.setCurrency(this.chainNetwork);
    this.priceProvider.setCurrency();

    this.messageForm = formBuilder.group({
      address: [
        '',
        Validators.compose([Validators.minLength(1), Validators.required])
      ],
      signature: [
        '',
        Validators.compose([Validators.minLength(1), Validators.required])
      ],
      message: [
        '',
        Validators.compose([Validators.minLength(1), Validators.required])
      ]
    });
  }
开发者ID:bitpay,项目名称:bitcore,代码行数:34,代码来源:messages.ts

示例7: constructor

 constructor(
   private navCtrl: NavController,
   private navParams: NavParams,
   private events: Events,
   private ab: AddressBookProvider,
   private addressProvider: AddressProvider,
   private formBuilder: FormBuilder,
   private logger: Logger,
   private popupProvider: PopupProvider
 ) {
   this.addressBookAdd = this.formBuilder.group({
     name: [
       '',
       Validators.compose([Validators.minLength(1), Validators.required])
     ],
     email: ['', this.emailOrEmpty],
     address: [
       '',
       Validators.compose([
         Validators.required,
         new AddressValidator(this.addressProvider).isValid
       ])
     ]
   });
   if (this.navParams.data.addressbookEntry) {
     this.addressBookAdd.controls['address'].setValue(
       this.navParams.data.addressbookEntry
     );
   }
   this.events.subscribe('update:address', data => {
     this.addressBookAdd.controls['address'].setValue(
       this.parseAddress(data.value)
     );
   });
 }
开发者ID:hcxiong,项目名称:copay,代码行数:35,代码来源:add.ts

示例8: constructor

 constructor(private fb : FormBuilder) {
   this.form = this.fb.group({
     oldPassword:  ['', Validators.compose([Validators.required])],
     newPassword:['', Validators.compose([Validators.required, PasswordValidator.checkPasswordLength])],
     confirmPassword:  ['', Validators.compose([Validators.required])]
   });
 }
开发者ID:priyangithub,项目名称:angulartwo,代码行数:7,代码来源:password-change.component.ts

示例9: ngOnInit

 ngOnInit(): void {
   this.userLoginFormGroup = this.formBuilder.group({
     email: ['', Validators.compose([Validators.required])],
     telephone: ['', Validators.compose([Validators.required])],
     password: ['', Validators.compose([Validators.required,Validators.minLength(7)])],
     confirmPassword:['', Validators.compose([Validators.required])]
   })
 }
开发者ID:ogomaemmanuel,项目名称:CytonMobile,代码行数:8,代码来源:registration.ts

示例10: ngOnInit

    ngOnInit() {
        this.loginForm = this.formBuilder.group({
            'username': ['user2@site.com', Validators.compose([Validators.required])],
            'password': ['123456', Validators.compose([Validators.required])]
        });

        this.validation.formGroup = this.loginForm;
    }
开发者ID:VladimirDimov,项目名称:Learning,代码行数:8,代码来源:login.component.ts


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