Reputation: 968
I couldn't solve this problem, I need help, here's my problem;
I have checkbox inputs as days(mon,tue,wed,thu,fri,sat,sun) and select options shifts(breakfast,lunch,dinner)
What I try to do is,
For example
If you select "mon" while "breakfast" selected: other "mon"s at other breakfast's line must be disabled, but not the one you select.
Here's my code:
day.html: focus on ----? part.
<label class="btn btn-info btn-sm {{ dayName }}">
<input type="checkbox" name="{{ dayName }}"
ng-model="dayName" ng-disabled="?----dayName----?">
</label>
controller has:
$scope.days = ["pzt","sal","car","per","cum","cmt","pzr"]
directive:
app.directive("day", function () {
return {
restrict: "E",
scope: {
dayName: "@"
},
templateUrl: "/static/templates/settings/day.html"
}
})
html:
<div class="form-group" style="margin-bottom:0;">
<div class="btn-group" data-toggle="buttons">
<day ng-repeat="d in days" data-id="breakfast" dayName="{{d}}"></day>
</div>
</div>
<div class="form-group" style="margin-bottom:0;">
<div class="btn-group" data-toggle="buttons">
<day ng-repeat="d in days" data-id="breakfast" dayName="{{d}}"></day>
</div>
</div>
Upvotes: 1
Views: 424
Reputation: 512
You can add conditions to ng-disabled like this:
<label class="btn btn-info btn-sm {{ dayName }}">
<input type="checkbox" name="{{ dayName }}"
ng-model="dayName" ng-disabled="dayName == 'mon' && breakfast">
</label>
Upvotes: 0