I have AngularJS template (modal dialog) and there is a code as following:
<div class="col-sm-9 dlg-input-pr">
<div>
<label for="ClientsURL">URL for client</label>
<input id="ClientsURL" ng-model="publishOptions.uniqueURL" type="text" class="uui-form-element" value="{{publishOptions.uniqueURL}}" select-on-click tabindex="1" />
</div>
</div>
<div class="col-sm-3 dlg-btn screen">
<ng-switch on="isPublishOptionsHidden">
<button ng-switch-when="true"
class="uui-button lime-green"
clip-copy="getTextToCopy()"
auto-focus>
Copy
</button>
<button ng-switch-when="false"
class="uui-button lime-green"
clip-copy="getTextToCopy()">
Copy
</button>
</ng-switch>
</div>
Here is function that gets the text to be copied:
$scope.getTextToCopy = function () {
return $scope.publishOptions.uniqueURL;
};
The first goal is to put focus on button when dialog opens, which I did using auto-focus directive. The second goal is to add the possibility when focus is on button to press enter and copy text from input box (ClientsURL). It doesn't work that is doesn't copy text to clipboard. It works when I click button using mouse.
How to solve this issue?
I have AngularJS template (modal dialog) and there is a code as following:
Here is function that gets the text to be copied:
The first goal is to put focus on button when dialog opens, which I did using auto-focus directive. The second goal is to add the possibility when focus is on button to press enter and copy text from input box (ClientsURL). It doesn't work that is doesn't copy text to clipboard. It works when I click button using mouse.
How to solve this issue?