Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/JsDaddy/ngx-copypaste

A pure and awesome copy paste directive for Angular
https://github.com/JsDaddy/ngx-copypaste

angular angular-clipboard angular-copypaste clipboard copypaste ngx ngx-clipboard ngx-copypaste typescript

Last synced: 12 days ago
JSON representation

A pure and awesome copy paste directive for Angular

Awesome Lists containing this project

README

        


NGX COPYPASTE



NGX COPYPASTE is the best directive to copy any content on any element

[![CI](https://github.com/JsDaddy/ngx-copypaste/actions/workflows/quality-check.yml/badge.svg?branch=develop)](https://github.com/JsDaddy/ngx-copypaste/actions/workflows/main.yml)
[![npm](https://img.shields.io/npm/v/ngx-copypaste.svg)](https://www.npmjs.com/package/ngx-copypaste)
[![npm downloads](https://img.shields.io/npm/dt/ngx-copypaste.svg)](https://npmjs.org/ngx-copypaste)

[![npm](https://img.shields.io/npm/dm/ngx-copypaste.svg)](https://www.npmjs.com/package/ngx-copypaste)

[![GitHub contributors](https://img.shields.io/github/contributors/JSDaddy/ngx-copypaste.svg?style=flat)](https://github.com/JSDaddy/ngx-copypaste)

[![GitHub stars](https://img.shields.io/github/stars/JSDaddy/ngx-copypaste.svg?label=GitHub%20Stars&style=flat)](https://github.com/JSDaddy/ngx-copypaste)

You can also try our NGX MASK [check](https://www.npmjs.com/package/ngx-mask) it.
You can also try our NGX LOADER INDICATOR [check](https://www.npmjs.com/package/ngx-loader-indicator) it.

### You can try live [demo](https://jsdaddy.github.io/ngx-copypaste/) with examples.

## Installing

```bash
$ npm install --save ngx-copypaste
```

## Quickstart if ngx-copypaste version >= 15.0.0

Pay attention this version works for angular >= 14.0.0

Import **ngx-copypaste** directive to your standalone component

```typescript
@Component({
selector: 'ngx-component',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss'],
standalone: true,
imports: [
(...)
NgxCopyPasteDirective,
(...)
],
})
export class AppComponent {
(...)
}
```

## Quickstart if ngx-copypaste version < 15.0.0

Pay attention this version works for angular < 15.0.0

Import **ngx-copypaste** module in Angular app.

```typescript
import {NgxCopyPasteModule} from 'ngx-copypaste'

(...)

@NgModule({
(...)
imports: [
NgxCopyPasteModule
]
(...)
})
```

#### Usage

From input

```html

Copy
```

From any HTML tag

```html

Lorem ipsum

Copy
```

From complex div

```html


Lorem ipsum



Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam rutrum augue at ante
sollicitudin posuere. Pellentesque congue consequat enim quis luctus.



Lorem ipsum



Copy
```

Also you can bind it to any tag

```html

Lorem ipsum

Copy


```

Output success cb

```html

Lorem ipsum

Copy

public copy(): void { your code }
```