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


TypeScript FormBuilder.control方法代碼示例

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


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

示例1: constructor

 constructor(private fb: FormBuilder, private authService: AuthService, private navController: NavController) {
     
     // Create the form controls
     this.userName = fb.control('');
     this.password = fb.control('');
     this.userForm = fb.group({
         username: this.userName,
         password: this.password
     });
 }
開發者ID:mco67,項目名稱:myWayIonic,代碼行數:10,代碼來源:loginPage.ts

示例2: constructor

 constructor(fb: FormBuilder) {
     this.email = fb.control('', Validators.compose([Validators.required, this.isEmailIppon]));
     this.password = fb.control('', Validators.compose([Validators.required, Validators.minLength(3)]));
     this.confirm = fb.control('', Validators.compose([Validators.required, Validators.minLength(3)]));
     this.passwordForm = fb.group({
         password: this.password, 
         confirm: this.confirm
     }, {
         validator: this.passwordMatch
     });
     this.loginForm = fb.group({
         email: this.email,
         passwordForm: this.passwordForm
     });
 }
開發者ID:qmonmert,項目名稱:angular2-form,代碼行數:15,代碼來源:formbuilder.component.ts

示例3: constructor

  constructor(private _apiservice: ApiService, fb: FormBuilder) {

    this.userForm = fb.group({
      bands: fb.control('', Validators.compose([Validators.required, Validators.minLength(3)])),
      date:  fb.control('', Validators.required),
      price: fb.control('', Validators.required),
      venue: fb.control('', Validators.required) 
    });

    this._apiservice
        .getGigs()
        .subscribe(gigs => this.gigs = gigs,
            error => console.log(error),
            () => console.log('Gigs loaded in add gig component')
        );
    }
開發者ID:xyulex,項目名稱:angular2-music,代碼行數:16,代碼來源:add.gig.component.ts

示例4: onSubmit

    onSubmit(event, form: any): void {
        console.log('you submitted value:', form);
/*
        this.myForm =  this.fb.group({
            'sku': ['', Validators.required],
            'sku1': ['', Validators.required]
        });
        
        
        */
        
        this.fb.control({
            'sku' : ""
        })
        
        
        this.sku = this.myForm.controls['sku'];
        this.sku.updateValueAndValidity("");
        this.sku.updateValueAndValidity("123");
        
        console.log(this.myForm.controls.sku.value);
        this.myForm.controls.sku.value = "Test";
		
    }
開發者ID:HansS,項目名稱:Teaching-Ionic-MeanStack-SSUET-2015-May-ModuleB,代碼行數:24,代碼來源:app.ts


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