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


TypeScript AbstractControl.get方法代码示例

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


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

示例1: dateRangeValidator

export function dateRangeValidator(c: AbstractControl): {[key: string]: any} {
  // Get controls in group
  const startDateC = c.get('startDate');
  const startTimeC = c.get('startTime');
  const endDateC = c.get('endDate');
  const endTimeC = c.get('endTime');
  // Object to return if date is invalid
  const invalidObj = { 'dateRange': true };

  // If start and end dates are valid, can check range (with prefilled times)
  // Final check happens when all dates/times are valid
  if (startDateC.valid && endDateC.valid) {
    const checkStartTime = startTimeC.invalid ? '12:00 AM' : startTimeC.value;
    const checkEndTime = endTimeC.invalid ? '11:59 PM' : endTimeC.value;
    const startDatetime = stringsToDate(startDateC.value, checkStartTime);
    const endDatetime = stringsToDate(endDateC.value, checkEndTime);

    if (endDatetime >= startDatetime) {
      return null;
    } else {
      return invalidObj;
    }
  }
  return null;
}
开发者ID:connelb,项目名称:fitwithlc,代码行数:25,代码来源:date-range.validator.ts

示例2:

export const passwordMatcher = (control: AbstractControl): {[key: string]: boolean} => {
  const password = control.get('password');
  const confirm = control.get('confirm');
  if (!password || !confirm) {
    return null;
  }
  return password.value === confirm.value ? null : { nomatch: true };
};
开发者ID:yurlovm,项目名称:lab12,代码行数:8,代码来源:password-matcher.ts

示例3: PasswordValidator

export function PasswordValidator(control: AbstractControl): { [key: string]: boolean } | null {
  const password = control.get('password');
  const confirmPassword = control.get('confirmPassword');
  if (password.pristine || confirmPassword.pristine) {
    return null;
  }
  return password && confirmPassword && password.value !== confirmPassword.value ? { 'misMatch': true } : null;
}
开发者ID:Dkumarsable,项目名称:angular,代码行数:8,代码来源:password.validator.ts

示例4: passwordsShouldMatch

    static passwordsShouldMatch(control: AbstractControl) {
        let newPassword = control.get('newPassword');
        let confirmPassword = control.get('confirmPassword');

        if (newPassword.value !== confirmPassword.value)
            return { passwordsShouldMatch: true };
        
        return null;
    }
开发者ID:krzysztofkarp,项目名称:udemy-angular,代码行数:9,代码来源:password.validators.ts

示例5: MatchPassword

 static MatchPassword(AC: AbstractControl) {
   const newPassword = AC.get('newPassword').value; // to get value in input tag
   const newPassword2 = AC.get('newPassword2').value; // to get value in input tag
   if (newPassword !== newPassword2) {
     AC.get('newPassword2').setErrors( {MatchPassword: true} );
   } else {
     return null;
   }
 }
开发者ID:aqsach,项目名称:new_cramefrenzy,代码行数:9,代码来源:password-validator.component.ts

示例6: MatchPassword

 static MatchPassword(AC: AbstractControl): any {
    let password = AC.get('password').value; // Get the password input value
    let passwordConfirm = AC.get('passwordConfirm').value; // get the passwordConfirm input value
     if(password != passwordConfirm) {
         AC.get('passwordConfirm').setErrors( {MatchPassword: true} )
     } else {
         return null
     }
 }
开发者ID:kittycash,项目名称:marketplace,代码行数:9,代码来源:password-validation.ts

示例7: comparePasswords

  comparePasswords(c: AbstractControl): { [key: string]: boolean } {
    const pass = c.get('password');
    const repeatPassword = c.get('repeatPassword');

    if (pass.value !== repeatPassword.value) {
      return { 'match': true };
    }
    return null;
  }
开发者ID:reisub0,项目名称:mainflux,代码行数:9,代码来源:signup.component.ts

示例8: ConfirmPasswordValidator

 static ConfirmPasswordValidator(control: AbstractControl) {
   const value = control.get('password').value;
   const otherValue = control.get('confirmpassword').value;
   if (value !== otherValue) {
     control.get('confirmpassword').setErrors({MatchError: true});
   } else {
     return null;
   }
 };
开发者ID:systers,项目名称:PC-Prep-Kit,代码行数:9,代码来源:Validators.ts

示例9: return

 return (control: AbstractControl): {[key: string]: any} | null => {
   const password = control.get('newpassword').value;
   const confirmPassword = control.get('confirmpassword').value;
   const isValid = password === confirmPassword;
   if (!isValid) {
     control.get('confirmpassword').setErrors({matchPassword: true});
   }
   return isValid ? null : {'matchPassword': {value: confirmPassword}};
 };
开发者ID:mwd-huyquangngo,项目名称:SWATANG,代码行数:9,代码来源:field-validator.ts

示例10: MatchPassword

 static MatchPassword(AC: AbstractControl) {
     const password = AC.get('password').value; // to get value in input tag
     const confirmPassword = AC.get('confirmPassword').value; // to get value in input tag
     if (password !== confirmPassword) {
         AC.get('confirmPassword').setErrors({ MatchPassword: true });
     } else {
         return null;
     }
 }
开发者ID:aqsach,项目名称:new_cramefrenzy,代码行数:9,代码来源:password-validator.component.ts


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