當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。