<script>
var webQueryApp = angular.module("webQueryApp", [ ]);
webQueryApp.directive('myDraggable', function(){
return{
scope: {
'arr':'=',
},
//link start
link: function ($scope, element, attrs) {
attrs.$observe('arr',function(){
console.log($scope.arr);
});
element.bind('click', function(event) {
console.log("element clicked and arr is "+attrs.arr);
});
}
//link end
};
});
webQueryApp.controller('TestAppController', function($scope, $http) {
var app = this;
console.log("hello console");
$scope.arr=[1,2,3,4];
});
</script>
<div ng-app="webQueryApp">
<div ng-controller="TestAppController">
<div class="operationalArea" my-Draggable data='arr' > click me </div>
</div>
</div>
</body>
</html>