I have written the following directive:
var gameOdds = function(){
return {
template: '{{games["@homeTeam"]}} vs {{games["@awayTeam"]}}',
scope: {
games: '@'
}
};
};
<div game-odds games="{{games}}">
This uses the following JSON data (part of the json is below):
{
@id: "69486",
@homeTeam: "Home Team",
@awayTeam: "Away Team",
otherNormalValues : {
etc: "normal..."
}
}
I know that the method of selecting these keys preceded with an @ symbol works when put directly into the HTML bound to a controller. But in my directive I cannot select the fields in this ["@field"] way.
Does anyone know how to do this?
gamesan array of objects? Suggest you create a simple demo with real data and controller. Not sure why you have@prefix for all your properties