Skip to main content

Command Palette

Search for a command to run...

Angular :4 How to create a clipboard copy functionality

Published
1 min read
S

I love learning about technology and sharing that with others

Steps

  1. install ngx-clipboard
  2. Add the clipboardModule in the app.module
import { ClipboardModule } from 'ngx-clipboard';
  1. in your template create a text area and then add a button in the text area add a reference and int he button we will add the ngxClipboard that will copy the text from the textarea
    <div class="form-group">
      <button [ngxClipboard]="requestjsontext" style="float:right;" class="btn btn-primary">copy</button>
      <label for="requestjson">Request Json</label>
      <textarea class="form-control" id="requestjsontextarea" rows="5" #requestjsontext></textarea>


    </div>
13 views

More from this blog

H

hashcodehub

271 posts

Consistent, Passionate and Organized :)