Ole*_*sov 6 zeroclipboard angularjs angularjs-directive
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();
});
});
}
}
}]);
Run Code Online (Sandbox Code Playgroud)
创建此指令的多个实例使swf对象仅针对整个应用程序上的第一个实例触发事件(复制了相同的链接).
显然我有多个链接,我想让我的用户在我的应用程序中复制.
任何帮助深表感谢
| 归档时间: |
|
| 查看次数: |
1252 次 |
| 最近记录: |