I have set up my ng-class like this:
<ul class="picker-dropdown list-inline form-control">
<li ng-repeat="colour in controller.colours.data" ng-class="{'active': controller.team.data.colours.indexOf(colour) > -1}">
<a href style="background-color: #{{ colour.hex }};" ng-click="controller.setColour(colour)"></a>
</li>
</ul>
and my team looks like this:
{
loading: false,
data: {
id: 0,
name: 'Test',
sport: '',
colours: [{
id: 31,
name: 'Hot Pink (Pms Magenta)',
hex: 'd40082'
},{
id: 32,
name: 'Baby Pink (196u)',
hex: 'ffc2cc'
},{
id: 33,
name: 'Cream',
hex: 'ffffe5'
}]
}
};
Now, I expect that the active class will be added to the three colours in my repeat. controller.colours.data looks like this:
[
{
"hex": "000000",
"id": 1,
"name": "Black"
},
{
"hex": "ffffff",
"id": 2,
"name": "White"
},
{
"hex": "001444",
"id": 3,
"name": "School Navy Blue"
},
{
"hex": "000e31",
"id": 4,
"name": "Sport Navy Blue Pms 532"
},
{
"hex": "003072",
"id": 5,
"name": "Royal Blue (Pms286)"
},
{
"hex": "83cce4",
"id": 6,
"name": "Pale Blue (Pms292)"
},
{
"hex": "051667",
"id": 7,
"name": "Reflex Blue (Pms Ref Blu)"
},
{
"hex": "0080bc",
"id": 8,
"name": "Cyan Blue (Process Cyan)"
},
{
"hex": "004066",
"id": 9,
"name": "Petrol Blue (Pms3035)"
},
{
"hex": "ff0000",
"id": 10,
"name": "Red (Pms200)"
},
{
"hex": "a50021",
"id": 11,
"name": "Cranberry (Pms209)"
},
{
"hex": "990033",
"id": 12,
"name": "Maroon (Pms202)"
},
{
"hex": "990000",
"id": 13,
"name": "Burgundy (Pms195)"
},
{
"hex": "003300",
"id": 14,
"name": "School Bottle Green"
},
{
"hex": "1d4012",
"id": 15,
"name": "Sport Bottle Green (Pms350)"
},
{
"hex": "12872b",
"id": 16,
"name": "Emerald Green (Pms347u)"
},
{
"hex": "336648",
"id": 17,
"name": "Sage Green (Pms5545)"
},
{
"hex": "089770",
"id": 18,
"name": "Leaf Green (Pms569)"
},
{
"hex": "e26b0a",
"id": 19,
"name": "Orange (Pms021)"
},
{
"hex": "ffc000",
"id": 20,
"name": "Gold (Pms1375)"
},
{
"hex": "ffff00",
"id": 21,
"name": "Sunshine (Pms1225c)"
},
{
"hex": "ffff66",
"id": 22,
"name": "Sunburst Pms115c)"
},
{
"hex": "a6a6a6",
"id": 23,
"name": "Grey (Pms Cool Grey 6c)"
},
{
"hex": "404040",
"id": 24,
"name": "Charcoal Pms432)"
},
{
"hex": "7030a0",
"id": 25,
"name": "Purple (Pms2613)"
},
{
"hex": "d40082",
"id": 26,
"name": "Hot Pink (Pms Magenta)"
},
{
"hex": "ffc2cc",
"id": 27,
"name": "Baby Pink (196u)"
},
{
"hex": "ffffe5",
"id": 28,
"name": "Cream"
},
{
"hex": "704626",
"id": 29,
"name": "Brown (Pms731)"
},
{
"hex": "351f16",
"id": 30,
"name": "Chocolate (Pms476)"
},
{
"hex": "d40082",
"id": 31,
"name": "Hot Pink (Pms Magenta)"
},
{
"hex": "ffc2cc",
"id": 32,
"name": "Baby Pink (196u)"
},
{
"hex": "ffffe5",
"id": 33,
"name": "Cream"
},
{
"hex": "ff0000",
"id": 34,
"name": "Red (Pms200)"
},
{
"hex": "a50021",
"id": 35,
"name": "Cranberry (Pms209)"
},
{
"hex": "990033",
"id": 36,
"name": "Maroon (Pms202)"
}
]
Does anyone know why this isn't working?