mercredi 8 novembre 2017

How can I add the checkbox value into the firebase? it always turn to undefined

HTML
<div class="form-group"  ng-controller="AddPostCtrl" >
<label for="availability">Availability:</label></br>
<label>Monday:
<input type="checkbox"  ng-init="article.disabled=false" ng-true-
value="true"
ng-false-value="false"
ng-model="article.disabled">
</label><br/>


</div>

APP.JS

var value1 = $scope.article.disabled;

console.log(value1);
firebase.database().ref('tutors/'+uid).set({Monday:value1}).then
(function(ref)
{

$location.path('/home');
});

Hello I want to save to my firebase the value of my checkbox but it requires to click all the checkboxes before it will save because if I not click it the output was error because of the undefined value from the checkbox. please help me.




Aucun commentaire:

Enregistrer un commentaire