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();
});
});
}
}
}]);创建此指令的多个实例使swf对象只为整个应用程序的第一个实例触发事件(复制的链接相同)。
显然,我有多个链接,我想让我的用户在我的应用程序复制。
任何帮助都非常感谢。
发布于 2014-01-22 17:17:01
这种“单例”行为在最新版本1.3.0β中得到了修正。
https://stackoverflow.com/questions/20473533
复制相似问题