1

I want to make a very simple input-group with an input that is disabled and a button that copies the input value to the clipboard. When it has been copied i want a small message popping up saying it was.

Is there any good way to do this?

this method don't seem to work, and it looks like a quick fix and does not look very nice.

copyInputMessage(inputElement){
    inputElement.select();
    document.execCommand('copy');
    inputElement.setSelectionRange(0, 0);
}

the html i got looks like this atm:

        <div class="input-group">
            <input class="form-control" disabled value="TextToBeCopied" #inputToBeCopied/>
            <button (click)="copyInputMessage(inputToBeCopied)" value="click to copy">COPY</button>
        </div>

I can only find very wierd solutions, there must be a more simple way?

I've seen the solutions that already exists, no one works for me and neither does fit my problem.

LittleMygler
  • 632
  • 10
  • 24

0 Answers0