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


TypeScript Validators.maxLength方法代码示例

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


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

示例1: getItemForm

    /**
     * Return the item form with default values and form controls.
     */
    getItemForm(): FormGroup {
        this.isDataType = this.partyType.getObjectName() === 'siteDataCenters'
                       || this.partyType.getObjectName() === 'siteDataSource';
        this.isMetadataCustodian = this.partyType.getObjectName() === 'siteMetadataCustodian';
        this.isDataCenter = this.partyType.getObjectName() === 'siteDataCenters';

        let individualNameValidators: any[] = !this.isDataType ? [Validators.required] : [];
        individualNameValidators.push(Validators.maxLength(200));

        let organisationValidators: any[] = (this.isDataType || this.isMetadataCustodian) ? [Validators.required] : [];
        organisationValidators.push(Validators.maxLength(200));

        return this.formBuilder.group({
            id: [null],
            individualName: ['', individualNameValidators],
            organisationName: ['', organisationValidators],
            positionName: ['', [Validators.maxLength(100)]],
            deliveryPoint: ['', [Validators.maxLength(2000)]],
            city: ['', [Validators.maxLength(100)]],
            administrativeArea: ['', [Validators.maxLength(100)]],
            postalCode: ['', [Validators.maxLength(25)]],
            country: [''],
            email: [''],
            primaryPhone: ['', [Validators.maxLength(25)]],
            secondaryPhone: ['', [Validators.maxLength(25)]],
            fax: ['', [Validators.maxLength(25)]],
            url: [''],
        });
    }
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:32,代码来源:responsible-party-item.component.ts

示例2: constructor

  constructor(
    private formBuilder: FormBuilder,
    private storeService: StoreService,
    private router: Router) {

    this.form = formBuilder.group({          
      'name': ['', [Validators.minLength(2), Validators.maxLength(20)]],
      'description': ['',[Validators.minLength(4), Validators.maxLength(255)]]
    });
  }
开发者ID:haochen21,项目名称:ticketClient,代码行数:10,代码来源:category-create.component.ts

示例3: getItemForm

 /**
  * Return the item form with default values and form controls.
  */
 getItemForm(): FormGroup {
     return this.formBuilder.group({
         id: [null],
         instrumentationType: ['', [Validators.required]],
         status: ['', [Validators.maxLength(2000)]],
         startDate: [''],
         endDate: [''],
         notes: ['', [Validators.maxLength(2000)]],
     });
 }
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:13,代码来源:collocation-information-item.component.ts

示例4: getItemForm

 /**
  * Return the item form with default values and form controls.
  */
 getItemForm(): FormGroup {
     return this.formBuilder.group({
         id: [null],
         possibleProblemSource: ['', [Validators.maxLength(100)]],
         startDate: [''],
         endDate: [''],
         notes: ['', [Validators.maxLength(2000)]],
         objectMap: [''],
     });
 }
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:13,代码来源:multipath-source-item.component.ts

示例5: getItemForm

 /**
  * Return the item form with default values and form controls.
  */
 getItemForm(): FormGroup {
     return this.formBuilder.group({
         id: [null],
         standardType: ['', [Validators.maxLength(200)]],
         inputFrequency: ['', [Validators.maxLength(25)]],
         startDate: [''],
         endDate: [''],
         notes: ['', [Validators.maxLength(2000)]],
         objectMap: [''],
     });
 }
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:14,代码来源:frequency-standard-item.component.ts

示例6: ngOnInit

 ngOnInit() {
   this.form = this._fb.group({
     email: new FormControl('', [Validators.required, Validators.maxLength(128), AuthenticationValidators.validateEmail]),
     username: new FormControl('',
       [Validators.required, Validators.maxLength(32)],
       [AuthenticationValidators.uniqueUsername(this._profileService, 300)]),
     password: new FormGroup({
       password: new FormControl('', [Validators.required, Validators.minLength(6)]),
       password2: new FormControl('', [Validators.required, Validators.minLength(6)])
     }, AuthenticationValidators.confirmation)
   });
 }
开发者ID:hemadri1982,项目名称:microservice-demo,代码行数:12,代码来源:registration.component.ts

示例7: ngOnInit

    // -----------------------------------------------------------------------------------------------------
    // @ Lifecycle hooks
    // -----------------------------------------------------------------------------------------------------

    /**
     * On init
     */
    ngOnInit(): void
    {
        // Reactive Form
        this.form = this._formBuilder.group({
            company   : [
                {
                    value   : 'Google',
                    disabled: true
                }, Validators.required
            ],
            firstName : ['', Validators.required],
            lastName  : ['', Validators.required],
            address   : ['', Validators.required],
            address2  : ['', Validators.required],
            city      : ['', Validators.required],
            state     : ['', Validators.required],
            postalCode: ['', [Validators.required, Validators.maxLength(5)]],
            country   : ['', Validators.required]
        });

        // Horizontal Stepper form steps
        this.horizontalStepperStep1 = this._formBuilder.group({
            firstName: ['', Validators.required],
            lastName : ['', Validators.required]
        });

        this.horizontalStepperStep2 = this._formBuilder.group({
            address: ['', Validators.required]
        });

        this.horizontalStepperStep3 = this._formBuilder.group({
            city      : ['', Validators.required],
            state     : ['', Validators.required],
            postalCode: ['', [Validators.required, Validators.maxLength(5)]]
        });

        // Vertical Stepper form stepper
        this.verticalStepperStep1 = this._formBuilder.group({
            firstName: ['', Validators.required],
            lastName : ['', Validators.required]
        });

        this.verticalStepperStep2 = this._formBuilder.group({
            address: ['', Validators.required]
        });

        this.verticalStepperStep3 = this._formBuilder.group({
            city      : ['', Validators.required],
            state     : ['', Validators.required],
            postalCode: ['', [Validators.required, Validators.maxLength(5)]]
        });
    }
开发者ID:karthik12ui,项目名称:fuse-angular-full,代码行数:59,代码来源:forms.component.ts

示例8: ngOnInit

	ngOnInit(){
		this.signinForm = this.fb.group({
				email: ['', [Validators.required, Validators.minLength(3),Validators.maxLength(30),emailValidator]],
				password: ['', [Validators.required]],
				captcha: ['', [Validators.required,Validators.minLength(6),Validators.maxLength(6)]]
		})
		this.globalValService.captchaUrlSubject.subscribe((captchaUrl:string) => {
			this.captchaUrl = captchaUrl
		})
		this.authService.snsLoginsSubject.subscribe((logins:string[])=>{
			this.logins = logins
		})
	}
开发者ID:jackhutu,项目名称:jackblog-angular2,代码行数:13,代码来源:login.component.ts

示例9: createForm

 createForm() {
   this.form = this.formBuilder.group({
     email: [this.authService.user.email, Validators.compose([
       Validators.required,
       Validators.maxLength(40),
       this.validateEmail
     ])],
     name: [this.authService.user.name, Validators.compose([
       Validators.required,
       Validators.minLength(1),
       Validators.maxLength(30)
     ])],
   });
 }
开发者ID:AdamSheaffer,项目名称:go,代码行数:14,代码来源:account.component.ts

示例10: getItemForm

 /**
  * Return the item form with default values and form controls.
  */
 getItemForm(): FormGroup {
     return this.formBuilder.group({
         id: [null],
         type: ['', [Validators.required, Validators.maxLength(100)]],
         manufacturer: ['', [Validators.required, Validators.maxLength(100)]],
         serialNumber: ['', [Validators.maxLength(100)]],
         heightDiffToAntenna: [''],
         calibrationDate: [''],
         startDate: [''],
         endDate: [''],
         notes: [['', [Validators.maxLength(2000)]]],
         objectMap: [''],
     });
 }
开发者ID:GeoscienceAustralia,项目名称:gnss-site-manager,代码行数:17,代码来源:water-vapor-sensor-item.component.ts


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