JSFiddle - React, Tailwind, and code Playground

by marcolepsy

HTML

<div ng-app="myApp" ng-controller="myCtrl">
    <div ng-repeat="shift in schedule.shifts">
        <div ng-repeat="tasks in shift" data-drag='{"taskIndex" : "{{$index}}", "shiftIndex" : "{{$parent.$index}}"}'></div>
    </div>
</div>

JavaScript

angular.module('myApp', [])
.controller('myCtrl', function($scope) {
    $scope.schedule = {
        shifts: [[1,2,3], [4,5,6], [7,8,9]]
    };
})
.directive('drag', function() {
    return {
        restrict: 'A',
        scope: {
            drag: '@'
        },
        link: function(scope, elem, attrs){
            
            // Grab the object data
            var dragData = "";
            
            scope.$watch(JSON.parse(attrs.drag), function (newValue) {
                console.log('Value: ', JSON.parse(attrs.drag));
                dragData = newValue;
            });
            
        },
        template: "{{drag}}"
    }  
});