Reputation: 24208
Thanks for looking. I am implementing ng-clip in my project successfully for various tasks such as copying a value to the clipboard when a user clicks a button. Of course this is handled declaratively like so:
<a clip-click-fallback="CopyStuff()" clip-copy="ModelToBeCopied">Foo</a>
I now have a need to add an item to the clipboard from the Angular controller, specifically, a string that is returned from the server in a call back function:
$scope.Callback = function(response){
//How do I copy the response to the clip board??
}
Any help is appreciated.
Upvotes: 0
Views: 111
Reputation: 4538
ng-clip
is a directive that uses ZeroClipboard, a flash based solution. You can't use ng-clip
in a controller. Copying to the clipboard without user interaction is a general Javascript challenge, not one specific to Angular.
See this question for possible solutions: How do I copy to the clipboard in JavaScript?
Upvotes: 1