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