@@ -45,7 +45,7 @@ angular.module('zeroclipboard', [])
45
45
var btn = element [ 0 ] ;
46
46
47
47
if ( angular . isFunction ( ZeroClipboard ) ) {
48
- client = scope . client = new ZeroClipboard ( btn ) ;
48
+ scope . client = new ZeroClipboard ( btn ) ;
49
49
}
50
50
51
51
scope . $watch ( 'value' , function ( v ) {
@@ -59,13 +59,13 @@ angular.module('zeroclipboard', [])
59
59
element . attr ( 'data-clipboard-text' , v ) ;
60
60
} ) ;
61
61
62
- client . on ( 'aftercopy' , _completeHnd = function ( e ) {
62
+ scope . client . on ( 'aftercopy' , _completeHnd = function ( e ) {
63
63
scope . $apply ( function ( ) {
64
64
scope . onCopied ( { $event : e } ) ;
65
65
} ) ;
66
66
} ) ;
67
67
68
- client . on ( 'error' , function ( e ) {
68
+ scope . client . on ( 'error' , function ( e ) {
69
69
if ( scope . onError ) {
70
70
scope . $apply ( function ( ) {
71
71
scope . onError ( { $event : e } ) ;
@@ -75,7 +75,7 @@ angular.module('zeroclipboard', [])
75
75
} ) ;
76
76
77
77
scope . $on ( '$destroy' , function ( ) {
78
- client . off ( 'complete' , _completeHnd ) ;
78
+ scope . client . off ( 'complete' , _completeHnd ) ;
79
79
} ) ;
80
80
}
81
81
} ;
0 commit comments