JSFiddle - React, Tailwind, and code Playground
HTML
<div id="app" ng-app="myApp" ng-controller="myCtrl">
<input type="checkbox" ng-model="answers[id]"
ng-change="stateChanged(id)" ng-checked="answers.id"/>
</div>
JavaScript
angular.module('myApp', []).controller('myCtrl', function($scope) {
$scope.answers = { id: true };
$scope.stateChanged = function (qId) {
if($scope.answers[qId]){ //If it is checked
alert('test');
} else {
alert("hhh");
}
}
});