Need a bit of help with angular and check boxes and how would put together one variable with all the checked values in. Here's what I have got so far but can't seem to figure out a good way on concatenating all the values which are checked so they can be shipped of to a REStful $resource. How would I get some variable or $scope item with all the checked values in it in the following format. e.g.:
types = Permanent,Contract,Any,Fixed Term
sample data of checkboxes ($scope.newJobSearch.type):
{
"Permanent": "Permanent",
"Contract": "Contract",
"Permanent or Contract": false,
"Any": "Any",
"Fixed Term": "Fixed Term"
}
<label class="checkbox-inline" for="{{jobType}}" ng-repeat="jobType in jobTypes ">
<input type="checkbox" id="{{jobType}}" value="{{jobType}}" ng-model="newJobSearch.type[jobType]" ng-true-value="{{jobType}}" ng-click="jobTypesCheck()"> {{jobType}}
</label>
$scope.newJobSearch = {};
function searchJobs(newJobSearch) {
angular.forEach(newJobSearch.type, function (value) {
if (value != false) {
$scope.queryTypes.push(value); //Dose not seem to work
//Some var in here which contains all the string values e.g:
//Permanent,Contract,Fixed Term
}
});
}