Is there a way to make a copy button with a copy function that will copy all the contents of a modal and you can paste it to notepad
相关问题
- angularJS: ui-router equivalent to $location.searc
- Separate AngularJS Controllers Into Separate Files
- Markdown to clipboard as rich text
- Angular ngAnimate not working first time on page l
- Ionic Spinner not showing up
相关文章
- Passing variable through URL with angular js
- Watch entire object (deep watch) with AngularJS
- Angular ng-if change span text
- How to add clipboard support to Matplotlib figures
- Can ng-show directive be used with a delay
- AngularJS $routeParams vs $stateParams
- Multiple parameters in AngularJS $resource GET
- How to set class/style of accordion heading in Ang
I needed this functionality in my
Controller
, as the text to be copied is dynamic, here's my simple function based on the code in the ngClipboard module:P.S.
You're welcome to add a comment now telling me how bad it is to manipulate DOM from a Controller.
If you have jquery support use this directive
Html
You can use a module I made, ngClipboard. Here's the link https://github.com/nico-val/ngClipboard
You can use either
ng-copyable
directive, or thengClipboard.toClipboard()
factory.if you don't want to add a new library to your project, and you create it by your self, here is a simple, easy solution:
note: I created it with promise functionality (which is awesome)
here is
CopyToClipboard.js module file
that's it, thanks to https://gist.github.com/JustMaier/6ef7788709d675bd8230
now let's use it
and finally the HTML
hope this saves your time