This is JavaScript function:


<script type="text/javascript">
    (function () {
        'use strict';
        // click events
        document.body.addEventListener('click', copy, true);
        // event handler
        function copy(e) {
            // find target element
            var
              t = e.target,
              c = t.dataset.copytarget,
              inp = (c ? document.querySelector(c) : null);
            // is element selectable?
            if (inp && inp.select) {
                // select text
                inp.select();
                try {
                    // copy text
                    document.execCommand('copy');
                    inp.blur();
                }
                catch (err) {
                    alert('please press Ctrl/Cmd+C to copy');
                }
            }
        }
    })();</script>


Usage:

<button id="CopyTextBtn" autofocus
        type="submit"
        class="uui-button lime-green"
        data-copytarget="#ClientsURL"
        ng-click="closeThisDialog('Cancel')">
    Copy</button>

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to