angular 2 - Copy string to clipboard automatically on value changes
<p>I have an angular service which returns a string and I want this string to be in the user's clipboard.</p>

<p>I've installed <a href="https://github.com/maxisam/angular2-clipboard" rel="nofollow">angular2-clipboard</a> to display the result in an input and let the user also click on the "copy" button in case of automatic copy failure.
But my wish is that when the input value bound to a property changes, it automatically set the clipboard content with that new value.</p>

<p>This is currently working:</p>

<pre><code>&lt;input readonly type="text" class="form-control" [(ngModel)]="createdCode"&gt;
&lt;button class="btn btn-default" type="button" ngIIclipboard [cbContent]="createdCode"&gt;copy&lt;/button&gt;
</code></pre>

<p>I have tried to find a way with ng-change to call "#btn.onclick()" to raise the click event but could not get the expected behaviour.</p>

<p>Is there a way to do this?</p>