I have a problem when I try to publish the flag value in my model on the server, and since the flag was not associated with the form, angular did not seem to assign a value to it, when I request the flag value, it returns as undefined.
Here is my markup:
<div class="form-group"> <input id="templateDisable" type="checkbox" ng-model="template.disabled" /> <label for="templateDisable">Disabled</label> </div>
And here is the version of my save action on my controller:
$scope.save = function (form) { if (form.$valid) { var formData = new FormData();
Actually, checking off and then unchecking the box before I click on the save result will cause the template.disabled property to be false, which I expected without manual intervention.
I saw other related questions, for example. AngularJS: The initial value of the flag is not in the model , but is it necessary, like a simple flag, to bake? I did not need to write directives for managing flags?
javascript angularjs checkbox
A. Murray
source share