lundi 6 mai 2019

Checkbox ng-model value not changing / updating as per checkbox click

I have below checkbox :-

<input type="checkbox" ng-click="toggleShowOtherUserConfiguration()" ng-model="showOtherUserConfiguration" name="ShowOtherUserConfiguration" value="showOtherUserConfiguration" />

in app.controller I have set :-

$scope.showOtherUserConfiguration = false;

So that checkbox will always remain false when page is loaded.

But what happening is :-

Checkbox is remaining unchecked when page is loading , at that time , $scope.showOtherUserConfiguration value is false.

When checkbox is checked , its value remains false.

When Checkbox status is changed from checked to unchecked , $scope.showOtherUserConfiguration value becomes true.

Please guide me how can $scope.showOtherUserConfiguration remain false when unchecked and true when checked ?

Note :- Not changing anything within toggleShowOtherUserConfiguration() function other than alterting $scope.showOtherUserConfiguration value




Aucun commentaire:

Enregistrer un commentaire