Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Calculator

0

78
Views
Angular 2 Disabled Required Control is invalid

I'm using Angular 2 Reactive Form. I have a form Control which is defined with required validation. When the user loads the form and this control is populated Angular consider the form control as valid. (Which is good!)

However, if the form control is populated and it's also disabled angular consider it as invalid? (W-H-Y?)

Have anyone encountered this? Is this a bug or by design?

Thanks!

8 months ago · Santiago Trujillo
1 answers
Answer question

0

This is by design, as per the W3C standard disabled inputs are not valid. In Angular you can use FormGroup.getRawValues() if you want to retrieve all values regardless of whether they are disabled or not.

Alternatively consider using the readonly attr instead.

8 months ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post job Plans Our process Sales
Legal
Terms and conditions Privacy policy
© 2023 PeakU Inc. All Rights Reserved.