Reputation: 7479
here is how I am trying now:
<ul
class="list"
list query="
{
'people': [{'people.id': '+id_+' }],
}
}"
>
<!-- ... -->
on the directive I do:
var query = scope.$eval(attrs.query);
but by logging this variable I can see that the '+id_+' variable is not 'replaced' it's value.
I know there are many other ways of achieving the same resilt, but I feel like this one would be the most dynamic for at least this situation.
Upvotes: 0
Views: 42
Reputation: 17492
You need to evaluate the the value of _id
when you pass it in as an attribute: {{_id}}
, see this plunk. However for the sake of readability I would avoid passing in Json objects like that into a directive, place that object on your controllers scope and pass that variable to the directive.
Upvotes: 1