Skip to content

Commit

Permalink
refactor(clipboard response): update copy subject data type (#186)
Browse files Browse the repository at this point in the history
* refactor(clipboard response): update copy subject data type

* fix(clipboard response): updated test and removed angulardoc.json from file tracking

* docs(copy response): update readme to refer to copyResponse$
  • Loading branch information
surajpoddar16 authored and maxisam committed May 20, 2019
1 parent 80e1366 commit 960e78d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ You can also use the structural directive *ngxClipboardIfSupported to conditiona
```

### Handle copy response globally
To handle copy response globally, you can subscribe to `copyObservable$` exposed by the `ClipboardService`
To handle copy response globally, you can subscribe to `copyResponse$` exposed by the `ClipboardService`

```
export class ClipboardResponseService {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('Directive: clipboard', () => {
it('should push copy response to copySubject', async(() => {
button.click();
const component = fixture.componentInstance;
clipboardService.copyObservable$.subscribe((res: IClipboardResponse) => {
clipboardService.copyResponse$.subscribe((res: IClipboardResponse) => {
expect(res).toBeDefined();
expect(res.isSuccess).toEqual(true);
expect(res.content).toEqual(component.text);
Expand Down
4 changes: 2 additions & 2 deletions projects/ngx-clipboard/src/lib/ngx-clipboard.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import { IClipboardResponse } from './interface';
export class ClipboardService {
private tempTextArea: HTMLTextAreaElement | undefined;

private copySubject = new Subject<{}>();
public copyObservable$: Observable<{}> = this.copySubject.asObservable();
private copySubject = new Subject<IClipboardResponse>();
public copyResponse$: Observable<IClipboardResponse> = this.copySubject.asObservable();

constructor(
@Inject(DOCUMENT) public document: any,
Expand Down

0 comments on commit 960e78d

Please sign in to comment.