Skip to content

Commit 0fc6c31

Browse files
author
Will Fairclough
committed
Added support for an onError callback from Zeroclipboard.
1 parent 06569d6 commit 0fc6c31

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/angular-zeroclipboard.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ angular.module('zeroclipboard', [])
3434
return {
3535
scope: {
3636
onCopied: '&zeroclipCopied',
37+
onError: '&?zeroclipOnError',
3738
client: '=?uiZeroclip',
3839
value: '=zeroclipModel',
3940
text: '@zeroclipText'
@@ -64,6 +65,15 @@ angular.module('zeroclipboard', [])
6465
});
6566
});
6667

68+
client.on('error', function(e) {
69+
if (scope.onError) {
70+
scope.$apply(function() {
71+
scope.onError({$event: e});
72+
});
73+
}
74+
ZeroClipboard.destroy();
75+
});
76+
6777
scope.$on('$destroy', function() {
6878
client.off('complete', _completeHnd);
6979
});

0 commit comments

Comments
 (0)