How can i pass a dynamic variable to selection for my ng-model of checkbox. Here is the the jsfiddle link.
http://jsfiddle.net/bmleite/PQvQ2/
Here i want to replace the id in .js file with a variable as:
function Ctrl($scope) { $scope.categories = [ { "name": "Sport", "id": "50d5ad" } , {"name": "General", "id": "678ffr" } ]; var someId = $scope.categories[1].id; $scope.selection = { ids: {someId: true} }; }
But it is not working. If i replace "someId" with "General", it works fine.