I am creating a web app in which i am using toggle button when a user click once on the toggle button 'yes' should be store in a $scope variable if the user click twice 'no' should be stored in a $scope variable
here is my codding for toggle button
<div class="switch">
<input ng-click="clickcheckbox()" id="cmn-toggle-1" class="cmn-toggle cmn-toggle-round" type="checkbox">
<label for="cmn-toggle-1"></label>
</div>
i have taken ng-click because i am not able to do this with ng-checked
here is my controller
$scope.clickcheckbox=function(){
//if user check the checkbox
$scope.check='yes';
//if user uncheck the checkbox
$scope.check='no';
}
if there are other better ways to do this(please help me out with them)
Aucun commentaire:
Enregistrer un commentaire