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


TypeScript FormBuilder.group方法代码示例

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


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

示例1: constructor

  constructor(private productService: ProductService) {
    this.categories = this.productService.getAllCategories();

    const fb = new FormBuilder();
    this.formModel = fb.group({
      'title': [null, Validators.minLength(3)],
      'price': [null, positiveNumberValidator],
      'category': ['']
    })
  }
开发者ID:AviFix,项目名称:angular2typescript,代码行数:10,代码来源:search.ts

示例2: constructor

  constructor(private navController: NavController , private fb: FormBuilder) {
    this.navController=navController;
    
        this.authForm = fb.group({  
            'username': ['', Validators.compose([Validators.required, Validators.minLength(4), CustomValidators.checkFirstCharacterValidator])],
            'password': ['', Validators.compose([Validators.required, Validators.minLength(4), CustomValidators.checkFirstCharacterValidator])]
        });
 
        this.username = this.authForm.controls['username'];     
        this.password = this.authForm.controls['password'];  
    }
开发者ID:tecnicoEA,项目名称:Validacion,代码行数:11,代码来源:home.ts

示例3: toControlGroup

 toControlGroup(questions: QuestionBase<any>[]) {
   let group = {};
   questions.forEach(q => {
     group[q.key] = q.required ?
       [q.value || '', Validators.required] :
       [q.value || ''];
   });
   console.log(group);
   // 构建表单验证选项
   return this.fb.group(group);
 }
开发者ID:RunningV,项目名称:angular2-rc,代码行数:11,代码来源:question-control.service.ts

示例4: constructor

  constructor(params: RouteParams) {
    var partyId = params.get('partyId');
    this.party = Parties.findOne(partyId);

    let fb = new FormBuilder();
    this.partyForm = fb.group({
     name: [''],
     description: [''],
     location: ['']
    });
  }
开发者ID:ijager,项目名称:Socially-Step8,代码行数:11,代码来源:party-details.ts

示例5: toControlGroup

    toControlGroup(questions:QuestionBase<any>[] ) {
        let group = {};

        console.log(questions.length);

        questions.forEach(question => {
            group[question.key] = question.required ? [question.value || '', Validators.required] : [];
        });

        return this.fb.group(group);
    }
开发者ID:mgratch,项目名称:angular2-recursive-repeater,代码行数:11,代码来源:question-control.service.ts

示例6: constructor

  constructor(public fb:FormBuilder, private _userService :UserService, public router:Router, private route: ActivatedRoute) {

    this.route.params.subscribe(params => {
      this.resetPasswordToken = params['token'];
    });

    this.resetPassForm = fb.group({
      password: [""],
      copass: [""],
    })
  }
开发者ID:giangdhwhtbr,项目名称:CapstoneProjectKShare,代码行数:11,代码来源:new-pass.ts

示例7: constructor

    constructor(
        private userService: UserService,
        private router: Router,
        fb: FormBuilder
    ) {
        this.loginForm = fb.group({
          username: ["", Validators.required],
          password: ["", Validators.required]
        });

    }
开发者ID:garciparedes,项目名称:node-examples,代码行数:11,代码来源:login.component.ts

示例8: constructor

  constructor(private router: Router) {
    super();

    let fb = new FormBuilder();

    this.forgetForm = fb.group({
      email: ['']
    });

    this.error = '';
  }
开发者ID:Feldor,项目名称:society,代码行数:11,代码来源:forget.ts

示例9: constructor

 constructor(
   private loginService: LoginService,
   private router: Router,
   private fb: FormBuilder,
   private appState: AppState,
   private ws: WelcomeStateService) {
   this.myForm = fb.group({
     'email': [],
     'password': []
   });
 }
开发者ID:mybrainishuge,项目名称:hello,代码行数:11,代码来源:login.ts

示例10: ngOnInit

 ngOnInit() {
     this.myForm = this._fb.group({
         firstName: ['', Validators.required],
         lastName: ['', Validators.required],
         email: ['', Validators.compose([
             this.isEmail,
             Validators.required
         ])], //compose allows you to pass multiple validators in an array
         password: ['', Validators.required]
     })
 }
开发者ID:PwBwolf,项目名称:Ang2-Node-mDB-Exp,代码行数:11,代码来源:signup.component.ts


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