2

According to the documentation and other SO questions, I should be able to output a set of key/value pairs with ng-repeat

$scope.getFilters = function(){

    return {
        film : true,
        game : true,
        music : true,
        sport : true,
        tv : true
    }
}
$scope.filters = $scope.getFilters();

Then this is my HTML

        {{filters}}
        <div 
            ng-repeat="(name,set) in filters"
        >
            {{name}} : {{set}}
        </div>

But this is all I get from that:

{"film":true,"game":true,"music":true,"sport":true,"tv":true}
<!-- ngRepeat: (name,set) in filters -->

I've tried JS fiddles, it works. This is only a snippet of my code, there is more on the page but I can't paste it all here.

UPDATE: Just noticed this error:

Error: Duplicates in a repeater are not allowed. Repeater: (name,set) in filters key: boolean:true
Pete
  • 4,542
  • 9
  • 43
  • 76
  • Ok - obvious now, found the error elsewhere on SO thanks to the console.log I added. http://stackoverflow.com/questions/16296670/angular-ng-repeat-error-duplicates-in-a-repeater-are-not-allowed – Pete Oct 15 '13 at 17:00

1 Answers1

1

This should work:

<div ng-repeat="row in [1,1,1] track by $index">

Check out this question for more details...Angular ng-repeat Error "Duplicates in a repeater are not allowed."

Hope this helps!

Community
  • 1
  • 1
Kai Feller
  • 653
  • 3
  • 14