Does anyone know if there is a way to transfer the value of a variable to Ctrl + C?
I'm working with AngularJS and within the scope I have a variable that I would like to pass to the clipboard, but I can not find anything that will help me.
Follow the code:
JS:
(function(){
'use script';
angular
.module('myApp')
.controller('meuCtrl', meuCtrl);
meuCtrl.$inject = ['$scope'];
function meuCtrl($scope){
$scope.grupos = [
{
"numero": 1,
"nome": "Grupo 1",
"link": "https://www.google.com.br/maps",
"visitado": true,
"data": "15/09/2017"
},
{
"numero": 2,
"nome": "Grupo 2",
"link": "https://mail.google.com/mail/u/0/#inbox",
"visitado": true,
"data": "15/09/2017"
}
]
$scope.copiar = function(teste) {
// aqui deve ser feita a atribuição
// clipboard = teste;
}
}
})();
Html:
<section ng-controller="meuCtrl">
<div ng-repeat="grupo in grupos">
<div ng-click="copiar(grupo.nome)">
<span>{{grupo.numero}}</span>
</div>
<div class="w3-container w3-button">
<a target="_blank" href="{{grupo.link}}"> <span>{{grupo.nome}}</span> </a>
</div>
</div>
</section>