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


TypeScript FormBuilder.control方法代码示例

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


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

示例1: constructor

 constructor(builder: FormBuilder) {
   this.form = builder.group({
     username: builder.control('', Validators.required),
     password: builder.control('', Validators.compose([
       Validators.required,
       Validators.minLength(10)
     ]))
   });
 }
开发者ID:mshahin364,项目名称:angular2_kochbuch_code,代码行数:9,代码来源:demo.component.ts

示例2: constructor

	constructor(private fb: FormBuilder, private userService: UserService, private router: Router) {

		// Create the username form control
		this.username = fb.control('', Validators.compose([Validators.required, Validators.minLength(3)]));
		this.username.valueChanges.subscribe((newValue) => { this.usernameErrorMessage = ''; });

		// Create the password form control
		this.password = fb.control('', Validators.compose([Validators.required]));
		this.password.valueChanges.subscribe((newValue) => { this.passwordErrorMessage = ''; });

		// Create the group
		this.userForm = fb.group({ username: this.username, password: this.password });
	}
开发者ID:mco67,项目名称:myWayWeb,代码行数:13,代码来源:login-page.component.ts

示例3: constructor

 constructor(builder: FormBuilder) {
   this.form = builder.group({
     username: builder.control('', Validators.required),
     password: builder.control('', Validators.compose([
       Validators.required,
       Validators.minLength(10),
       function containsCapital(control: Control) {
         const reg = /[A-Z]/;
         if (reg.test(control.value)) {
           return null;
         } else {
           return {
             containsCapital: true
           };
         }
       }
     ]))
   });
 }
开发者ID:mshahin364,项目名称:angular2_kochbuch_code,代码行数:19,代码来源:demo.component.ts

示例4: constructor

 constructor(builder: FormBuilder) {
   this.form = builder.group({
     username: builder.control('', Validators.required,
         function usernameExists(control: Control) {
           return new Promise((resolve) => {
             setTimeout(() => {
               if (control.value === 'Max') {
                 resolve({
                   usernameExists: true
                 });
               } else {
                 resolve(null);
               }
             }, 1000);
           });
         }),
     password: builder.control('',
         Validators.compose([Validators.required, Validators.minLength(10)]))
   });
 }
开发者ID:mshahin364,项目名称:angular2_kochbuch_code,代码行数:20,代码来源:demo.component.ts

示例5: _guestBuilder

    private _guestBuilder(form: ControlGroup) {
        form.addControl("name", this._fb.control(""));

    }
开发者ID:ckile,项目名称:GoldenVoyage,代码行数:4,代码来源:formBuilder.ts

示例6: createControl

 createControl(): AbstractControl {
   return this._control = this.formBuilder.control(this._model ? "on" : undefined);
 }
开发者ID:nirajaryal,项目名称:ng2-formly,代码行数:3,代码来源:formlyfield.checkbox.ts

示例7: createControl

 createControl(): AbstractControl {
   return this.formBuilder.control(this.model[this.key] ? "on" : undefined);
 }
开发者ID:ckniffen,项目名称:ng2-formly,代码行数:3,代码来源:formlyfield.checkbox.ts

示例8: constructor

 constructor(builder: FormBuilder) {
   this.form = builder.group({
     username: builder.control(''),
     password: builder.control('')
   });
 }
开发者ID:mshahin364,项目名称:angular2_kochbuch_code,代码行数:6,代码来源:demo.component.ts


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