landers.angular
Version:
landers.angular
20 lines • 726 B
JavaScript
;angular.module('Landers.angular')
.directive('copyText', [function(){
return {
restrict : 'A',
link : function($scope, $ele, $attrs) {
var fromKey = $attrs['copyTextFrom'];
var $from = fromKey ? $(fromKey) : $();
(function(){
var text = $attrs['copyText'];
var value = $from.val() || $from.text();
text = text || value;
if ($.fn.zclip && text) {
$ele.zclip({copy: text});
} else {
setTimeout(arguments.callee, 300);
}
})();
}
};
}]);