How to have several checkboxes use the same ng-template?

advertisements

I am using Ionic framework for mobile app development. I set multiple checkboxes using the same ng-model, so when I click one checkbox all three checkboxes should be clicked. But the values are not stored. But I want normal HTML checkboxes (i.e) values stored in the same field in my db separated by commas.

<label class="item item-input item-floating-label">Gender</label>
<input type="checkbox" ng-model="data.days" value="sunday">sunday
<input type="checkbox" ng-model="data.days" value="monday">monday


i am getting day's in single ng-model.

Sample Code

<div ng-repeat="day in days1" class="week_days">
        <ion-checkbox ng-model="day.select" style="border:none">{{day.name}}</ion-checkbox>
    </div>

controller side

$scope.days = [{
            "id": 1,
            "name": "Mon",
            "select": true
        }, {
            "id": 2,
            "name": "Tue",
            "select": true
        }, {
            "id": 3,
            "name": "Wed",
            "select": true
        }, {
            "id": 4,
            "name": "Thu",
            "select": true
        }, {
            "id": 5,
            "name": "Fri",
            "select": true
        }, {
            "id": 6,
            "name": "Sat",
            "select": true
        }, {
            "id": 0,
            "name": "Sun",
            "select": true
        }];

above code is default all checkbox is selected when click on checkbox then auto modified days object.