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


TypeScript Validators.compose方法代码示例

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


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

示例1: constructor

 constructor(builder: FormBuilder) {
   
   this.user = new User('joe.satriani@gmail.com', 'secretpass');
   
   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) => {
     console.log('email', value);
   });
   this.password.valueChanges.subscribe((value: string) => {
     console.log('password', value);
   });
   this.group.valueChanges.subscribe((value: any) => {
     console.log('form', value);
   });
 }
开发者ID:ShivKamal,项目名称:ngCourse2,代码行数:28,代码来源:my-form.component.ts

示例2: constructor

 constructor(
     private authService: AuthService, private router: Router, private builder: FormBuilder) {
   this.username =
       new Control('', Validators.compose([Validators.required, Validators.minLength(4)]));
   this.password = new Control('', Validators.compose([Validators.required]));
   this.loginForm = builder.group({username: this.username, password: this.password});
 }
开发者ID:mmrath,项目名称:base-app-dashboard,代码行数:7,代码来源:login.component.ts

示例3: ngOnInit

 ngOnInit() { 
     
     this.name = new Control('',
         Validators.compose([
             Validators.required
         ]));
         
      this.price = new Control('',
         Validators.compose([
             Validators.required
         ]));
         
      this.description = new Control('',
         Validators.compose([
             Validators.required,
             Validators.minLength(3),
             Validators.maxLength(50)
         ]));
         
      this.insertForm = this._fb.group({
          'name': this.name,
          'price': this.price,
          'description': this.description
      });
     
 }
开发者ID:jmdagenais,项目名称:angular2DemoApp,代码行数:26,代码来源:product-insert.component.ts

示例4: constructor

 constructor(private auth: Auth,
             private router: Router) {
   this.loginForm = new ControlGroup({
     email: new Control('user@example.com', Validators.compose([Validators.required])),
     password: new Control('secret', Validators.compose([Validators.required]))
   });
 }
开发者ID:tb,项目名称:ng2-api-examples,代码行数:7,代码来源:login.component.ts

示例5: constructor

 constructor(private eventService: EventService, 
     private builder: FormBuilder, private router: Router) {
   this.name = new Control('', Validators.required);
   this.date = new Control('', Validators.required);
   this.time = new Control('', Validators.required);
   this.price = new Control('', Validators.compose([Validators.required, Validators.pattern('\\d\+(\\.\\d{0,2})?')]));
   this.address = new Control('', Validators.required);
   this.city = new Control('', Validators.required);
   this.country = new Control('', Validators.compose([Validators.required, Validators.pattern('[A-Z]{2}')]));
   this.imageUrl = new Control('', Validators.required);
   // this.country = new Control('', exactly2);
   
   this.newEventForm = builder.group({
     name: this.name,
     date: this.date,
     time: this.time,
     price: this.price,
     location: builder.group({
       address: this.address,
       city: this.city,
       country: this.country
     }),
     imageUrl: this.imageUrl,
   })
 }
开发者ID:joeeames,项目名称:ng2-fundamentals-demo,代码行数:25,代码来源:create-event.component.ts

示例6: constructor

    constructor(
        private events: Events,
        private nav: NavController,
        private auth: AuthProvider,
        private formBuilder: FormBuilder) {

        this.name = new Control("", Validators.compose([
            Validators.required,
            Validators.minLength(6),
            Validators.maxLength(64)
        ]));
        this.email = new Control("", Validators.compose([
            Validators.required,
            Validators.pattern("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$"),
            Validators.minLength(6),
            Validators.maxLength(64)
        ]));
        this.password = new Control("", Validators.compose([
            Validators.required,
            Validators.minLength(6),
            Validators.maxLength(24)
        ]));

        this.registerForm = formBuilder.group({
            "name": this.name,
            "email": this.email,
            "password": this.password
        });
    }
开发者ID:isman-usoh,项目名称:followork,代码行数:29,代码来源:register.ts

示例7: 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:ShivKamal,项目名称:ngCourse2,代码行数:26,代码来源:my-form.component.ts

示例8: constructor

 constructor(private _carservice:CarsService,fb:FormBuilder,private _router:Router){
     this.registerForm = fb.group({
         username:['',Validators.compose([Validators.required,Validators.minLength(5)])],
         password:['',Validators.compose([Validators.required,Validators.minLength(5)])]
     })
     console.log(this.registerForm.controls);
 }
开发者ID:kam2001,项目名称:motor,代码行数:7,代码来源:register.component.ts

示例9: constructor

  constructor(private nav: NavController, private fb: FormBuilder, private userData: UserData) {
    this.authForm = fb.group({
      'email': ['', Validators.compose([Validators.required, CustomValidators.checkEmailValidator])],
      'password': ['', Validators.compose([Validators.required, Validators.minLength(6)])]
    });

    this.email = this.authForm.controls['email'];
    this.password = this.authForm.controls['password'];
  }
开发者ID:namnguyen289,项目名称:hien-mau,代码行数:9,代码来源:sign-up.ts

示例10: ngOnInit

    ngOnInit() {
        this.authForm = this.fb.group({  
            'username': ['', Validators.compose([Validators.required, Validators.minLength(3)])],
            'password': ['', Validators.compose([Validators.required, Validators.minLength(3)])]
        });
 
        this.username = this.authForm.controls['username'];     
        this.password = this.authForm.controls['password'];
    }
开发者ID:PhilippeAMAT,项目名称:Ionic2,代码行数:9,代码来源:login.ts


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