I am implementing checkbox and also I want to set status(true, false) in url as a parameter But only false value is set in url parameter. But When I click on checkbox then true value is not set in url as a parameter. I am using $location.search. I not able to find out what is the issue with true value.
var app = angular.module('demo', ['rzModule', 'ui.bootstrap']);
app.controller('MainCtrl', function($scope, $rootScope, $timeout) {
$scope.confirm = function(){
alert($scope.checkboxModel.value);
$location.search({checkbox: $scope.checkboxModel.value});
}
})
<link href="http://ift.tt/1FHelXo" rel="stylesheet"/>
<script src="http://ift.tt/1MeTcXW"></script>
<script src="http://ift.tt/2vbLpZF"></script>
<script src="http://ift.tt/2rcl0tm"></script>
<div ng-app="demo">
<div ng-controller="MainCtrl" class="wrapper">
checkbox status should set in url as parameter
<label>
<input type="checkbox" ng-model="checkboxModel.value" data-ng-change="confirm()"/>
</label>
</div>
</div>
Aucun commentaire:
Enregistrer un commentaire