문제

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();
          });  

        });
      }
    }
  }]);

Creating multiple instances of this directive makes the swf object to trigger the event only for the first instance over the the entire application(same link copied).

obviously I have more than one link that I would like to allow my user to copy in my application.

Any help is much appreciated

도움이 되었습니까?

해결책

This 'singleton' behavior was fixed in the latest release 1.3.0 beta.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top