When your function directive is executed, the element does not exist
yet in the DOM.
So jquery.data can't be used in a directive.
You can add an attributes and its value with a directive:
'div[data-id]':function(arg){
return arg.item.firstName;}
It is ok if you want to store a single item. But it will be converted
as a string.
The result will be like <div data-id="Adam">
This strangely non namespaced "data-" comes from HTML5 specs.
For more serious storage you can build your cache system like
jquery.data(...)
Then set a data-id attribute as above and set/get in a global object
hash table(like jQuery.cache) your data with an id.
That's what I did for the app we are building.
cheers,