How do I copy a string value's text to the user's clipboard?

Hey there,

I am very new coding on and for mobile phones in general, so I apologize if the answer is obvious. I attained longitude and latitude values from Google maps in the below code, and combined those numbers to make a valid link.

My question how do I code a button to copy the text from $google_l to the user's clipboard after they tap it (so they can paste it into a text message.)

Note that "google_link" is a combination of template text and two values, longitude and latitude.

var requestData = {};

// read more about using rest services:
function(success){ // success callback
(function mapping5252(success, $scope){
var la_scope = $;
var lo_scope = $scope.lo;
la_scope = success.coords.latitude;
lo_scope = success.coords.longitude;
$ = la_scope;
$scope.lo = lo_scope;
var google_link = "" + $ + "," + $scope.lo;
$google_l = google_link;

})(success, $scope);

function(error){ // callback to handle request error

function(notify){ // notify callback, can fire few times

1 person has
this question