Issue
HTML Part:
<label>Do you want to check this? <input type="checkbox" ng-model="checkModel" >
</label><br/>
Controller Part:
$http.post("InsertParticipant.jsp?comments1=" + $scope.comment + "&checked_value=" + $scope.checkModel + "&request_id=" +id).
then(function(response){
if(response.data.match("SUCCESS")){
alert("Entry has been added");
}
else{
alert("Sorry something went wrong Try filling it again");
}
It is coming undefined for the checkbox value.Can someone help me how to handle this?
Solution
You need to add values for your checkModel variable, like so
$scope.checkModel = {
value1 : true,
value2 : 'YES'
};
See the angular.js documentation with examples here: angular-input[checkbox]
Answered By - ryan123
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.