An AngularJs form requires the user to input the number of hours worked. If the value entered is 0, an additional question should be displayed for the reason why no work was done.
<label>Hours worked:</label>
<input ng-model="hours" type="number" placeholder="8" />
<label ng-class="{'disabled-label': ifHoursZero}">Reason for not working:</label>
<input ng-disabled="ifHoursZero" ng-model="reason" type="text" />
How can CSS and input fields be toggled elegantly in Angular based on the value of hours
, specifically when it is equal to 0? Is there a pattern or method that directly links this behavior to the hours
variable?