
i want to retrive checkbox value on submit event.i am using mongodb database.console i am getting value like this Tyres,Spares,Accessories.i have made view page based on output.if when i click check box i got error in console
TypeError: Cannot assign to read only property 'selected' of 'tyres'.how could i solve this please some one help me out
'use strict';
/**
* @ngdoc object
* @name test1.Controllers.Test1Controller
* @description Test1Controller
* @requires ng.$scope
*/
angular
.module('test1')
.controller('Test1Controller', [
'$scope', '$http', '$location', '$window',
function($scope, $http, $location, $window) {
$http.get('***').success(function(data, status, response) {
$scope.items = (JSON.stringify(data[0].D_Services).replace(/\"/g, "")).split(',');
console.log($scope.items);
});
$scope.check = function(items) {
console.log(items);
};
}
]);
<div ng-controller="Test1Controller" data-ng-init="loadservice()">
<div ng-repeat="item in items">
<input type="checkbox" ng-model="item.selected" ng-true-value="'Y'" ng-false-value="'N'" /> {{item}}
</div>
<input type="button" name="submit" value="submit" ng-click="check(items)" />
</div>
how can i grab all selected check box values on submit action only