Checkboxes somehow auto uncheck in emulator


I came up with very interesting problem. I’m developing an application with ionic framework in which I have an array of objects representing my states of the checkboxes and their values. I would like to set up a notification every time a checkbox has been checked and I would like to cancel the given notification when the given checkbox is unchecked. The problem is that every time I check a given checkbox and I try to click something else after that - the current checkbox triggers its ng-click function again without me clicking on it. I tested this in the browser and it works correctly. But it doesn’t work with the iOS emulator.

Any thoughts why this is happening?

Note: The code for the notifications is not added during the debugging. Because it won’t work in the browser.

I have the following code in my view.

<span ng-repeat="item in alerts"> <label class="checkbox" for="{{ item.text }}"> <input type="checkbox" ng-model="item.checked" ng-click="alertSubmit(item)" /> {{ item.text }} </label> </span>

And this is what I have in my controller.

`$scope.alerts = [
{ id: 0, text: “5 seconds”, checked: false},
{ id: 1, text: “10 seconds”, checked: true},
{ id: 2, text: “15 seconds”, checked: false},
{ id: 3, text: “20 seconds”, checked: false}

$scope.alertSubmit = function(newAlert){
if(newAlert.checked == true){
$scope.alerts[].checked = true;
alert(“will schedule a notification”);
// code which shedules notification shuld go here
$scope.alerts[].checked = false;
alert(“will cancel the notification”);
// code which cancel notification shuld go here