Angular - ng-repeat, checkboxes 14226439

http://angularjs.org/

by mrajcok

HTML

<div ng-controller="MyCtrl">
  <ul>
    <li ng-repeat="(genre, checked) in preferred_genres">
      <input type="checkbox" ng-model="preferred_genres[genre]" id="genre-{{$index + 1}}">
        <label for="genre-{{$index + 1}}">{{genre}}</label>
      </li>
  </ul>
    {{preferred_genres}}
</div>

JavaScript

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
    $scope.preferred_genres = {"Action & Adventure":true,"Animation":true,"Art House & International":true,"Classics":false,"Comedy":true,"Documentary":true,"Drama":true,"Horror":true,"Kids & Family":true,"Musical & Performing Arts":true,"Mystery & Suspense":false,"Romance":true,"Science Fiction & Fantasy":true,"Special Interest":true,"Sports & Fitness":true,"Television":false,"Western":false}
;
}