app.directive('copyPost', ['$window', '$filter', 'ZeroClipboardPath', function ($window, $filter, ZeroClipboardPath) {
return {
scope: {
postFn: '&',
postSuccess: '&',
},
restrict: 'A',
terminal: true,
prioriry: 10,
link: function (scope, element, attrs) {
scope.disaplyValue = 'Copy';
ZeroClipboardPath = 'lib/zeroclipboard/ZeroClipboard.swf';
var clip = new ZeroClipboard( $(element), {
moviePath: ZeroClipboardPath
});
clip.on('dataRequested', function(client, args) {
scope.postFn().then(function(data){
client.setText(data.data[0].external_url);
scope.postSuccess();
});
});
}
}
}]);
Creating multiple instances of this directive makes the swf object to trigger the event only for the first instance over the the entire application(same link copied).
obviously I have more than one link that I would like to allow my user to copy in my application.
Any help is much appreciated
This 'singleton' behavior was fixed in the latest release 1.3.0 beta.