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


TypeScript FormBuilder.group方法代碼示例

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


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

示例1: constructor

    constructor(public http: Http, public fb: FormBuilder){

        this.myForm =  fb.group({
            sku: ['ABC123', Validators.required],
            sku1: ['ABC1234', Validators.required]
        });
        
        console.log(this.myForm.value)
        
    } 
開發者ID:HansS,項目名稱:Teaching-Ionic-MeanStack-SSUET-2015-May-ModuleB,代碼行數:10,代碼來源:app.ts

示例2: constructor

    constructor(fb: FormBuilder, private dn: DonationService,
        private params: RouteParams, private rss: ReservationService,
        private router: Router) {

        this.form = fb.group({
            "description": ["", Validators.required]
        });

        this.donation = dn.getByTitle(decodeURIComponent(params.get("title")));
    }
開發者ID:MuhammedHasan,項目名稱:comodo-intership-program-application-project,代碼行數:10,代碼來源:detail.component.ts

示例3: constructor

  constructor(private fb: FormBuilder, private translate: TranslateService) {
    this.translate = translate;
    this.authForm = fb.group({
      'username': ['', Validators.compose([Validators.required, Validators.minLength(8), this.checkFirstCharacterValidator])],
      'password': ['', Validators.compose([Validators.required, Validators.minLength(8), this.checkFirstCharacterValidator])]
    });

    this.username = this.authForm.controls['username'];
    this.password = this.authForm.controls['password'];
  }
開發者ID:quanganh206,項目名稱:ionic2-kitchen-sink-ts,代碼行數:10,代碼來源:login.ts

示例4: constructor

	constructor(private router: Router) {
		let fb = new FormBuilder();
 
    	this.loginForm = fb.group({
	      email: ['',Validators.required],
	      password: ['',Validators.required]
	    });

	    this.error = '';
  }
開發者ID:adwaitsharma,項目名稱:web-flashcards,代碼行數:10,代碼來源:login-form.ts

示例5: constructor

 constructor(fb: FormBuilder) {
     this.form = fb.group({
         // three args: default, validators, async validators.
         username: ['', Validators.compose([
             Validators.required,
             UsernameValidators.cannotContainSpace,
         ]), UsernameValidators.shouldBeUnique],
         password: ['', Validators.required]
     });
 }
開發者ID:lee-woodridge,項目名稱:angular2-course,代碼行數:10,代碼來源:signup-form.component.ts

示例6: constructor

	constructor(fb: FormBuilder, public addressService: Addresses, private router: Router) {

		this.addressForm = fb.group({
			'mail': ['', Validators.compose([
						 Validators.required, mailValidator])],
			'firstName': ['', Validators.required],
			'lastName': ['', Validators.required],
			'country': ['', Validators.required]
		});
	}
開發者ID:szymon-wiatr,項目名稱:angular2-address-book,代碼行數:10,代碼來源:index.ts

示例7: constructor

    constructor(private fb: FormBuilder) {
        this.email = new Control();

        this.aboutUsForm = fb.group({
            email: this.email
        });

        this.email.valueChanges
            .subscribe(value => this.data = value);
    }
開發者ID:BaliJS,項目名稱:ng2-website-demo,代碼行數:10,代碼來源:contactus.component.ts

示例8: constructor

    constructor(fb: FormBuilder) {

        this.skuForm = fb.group({
            'sku': ['', Validators.compose([
                Validators.required, skuValidator
            ])]
        })

        this.sku = this.skuForm.controls['sku'];
    }
開發者ID:JackWCollins,項目名稱:Angular-2-Forms,代碼行數:10,代碼來源:demo_form_with_custom_validations.ts

示例9: constructor

  constructor(formBuilder: FormBuilder, public nav: NavController, public events: Events, public http: HttpService, public menu: MenuController) {
    this.nav = nav;
    this.events = events;
    this.http = http;

    // Build login form with validators
    this.loginForm = formBuilder.group({
            username: ["", Validators.compose([Validators.required, ValidationService.emailValidator])],
            password: ["", Validators.required]
    });
  }
開發者ID:vmarchaud,項目名稱:share_eat_mobile,代碼行數:11,代碼來源:login.ts

示例10: constructor

 constructor(fb: FormBuilder, private login: LoginService){
     this.form= fb.group({
        username:['',Validators.compose([
            Validators.required,
            UsernameValidators.cannotContainSpace
        ]),Validators.composeAsync([
            UsernameValidators.shouldBeUnique, 
            UsernameValidators.shouldNotBeEmpty])],
        password: ['',Validators.required]
     });
 }
開發者ID:cristianmurillo87,項目名稱:cursoAngular2,代碼行數:11,代碼來源:sign-up.component.ts


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