Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

form control adding disabled and validators

value: string;
isDisabled: boolean;
//isDisabled and value come from your dynamic data.  
fb: FormBuilder;
myGroup: FormGroup;

this.myGroup = fb.group({
   form_control_name: new FormControl({
      value: this.value,
      disabled: this.isDisabled,
      Validators.required)}
   );
 
PREVIOUS NEXT
Tagged: #form #control #adding #disabled #validators
ADD COMMENT
Topic
Name
2+7 =