I have an AngularJs form where I want to know the amount of hours worked. If the amount is 0
, I want to enable an extra question for the reason of not working.
<label>How many hours did you work?</label> <input ng-model="hours" type="number" placeholder="8" /> <label ng-class="{'disabled-label': ifHoursZero}">Why didn't you work at all?</label> <input ng-disabled="ifHoursZero" ng-model="reason" type="text" />
What is the elegant Angular way to toggle CSS and input fields with ifHoursZero
if the hours
value is 0
. Can this be done directly with the hours
variable with some pattern?
ng-show
andng-hide