How can I have an attribute with it's data being an object? I want to set the data to two indices:
<div ng-repeat="shift in schedule.shifts">
<div ng-repeat="tasks in shift" data-drag="{'taskIndex' : $index, 'shiftIndex' : $parent.$index}"></div>
</div>
I basically want to set data-drag
to contain both the $index
and $parent.$index
. The code above doesn't work!
Thanks
EDIT
So the problem is not the syntax above. It comes from this other line that I have:
// Grab the object data
var dragData = "";
scope.$watch(attrs.drag, function (newValue) {
dragData = newValue;
});
The $watch
returns this error:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
If I simply assign data-drag="$index"
then, it is all fine. Why is it that I cannot pass an object?
Why?
data-drag="{'taskIndex' : $index, 'shiftIndex' : $parent.$index}"
returns an error! The syntax is wrong ... It says$digest()
aborted after trying for 10 times. – Kousha 1 hour ago