vendredi 4 janvier 2019

Angularjs check box selected values not identified

Hi this question already asked but that not solving my issue.

I'm passing checkbox values to controller but i can't identify which one is selected.

This is my code

HTML:

<div class="col-sm-3" ng-repeat="days in formData.businessDays">
   <input type="checkbox" ng-model="business_days.Selected" ng-change=")"><span>  </span>
</div>

Js:

$scope.addData = function(form)
{
    $scope.formData.days_id = [];
    angular.forEach($scope.formData.businessDays, function(businessDays){
       //console.log(businessDays);
        if (businessDays.Selected) {
            $scope.formData.days_id.push(businessDays.value);
        }
    })
}

//this days data values
$scope.formData.businessDays = [{
                    name: "Monday",
                    value: "M",
                  }, {
                    name: "Tuesday",
                    value: "T",
                  }, {
                    name: "Wednesday",
                    value: "W",
                  }, {
                    name: "Thursday",
                    value: "Th",
                  }, {
                    name: "Friday",
                    value: "F",
                  }, {
                    name: "Saturday",
                    value: "S",
                  }, {
                    name: "Sunday",
                    value: "Su",
                  }, ];

This is my console image enter image description here

I can't identify which on is selected values ?




Aucun commentaire:

Enregistrer un commentaire