Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

copy after http request? #43

Open
ghost opened this issue Oct 16, 2014 · 0 comments
Open

copy after http request? #43

ghost opened this issue Oct 16, 2014 · 0 comments

Comments

@ghost
Copy link

ghost commented Oct 16, 2014

It this somehow possible?
I am trying to get it working to copy data that I get after http success request. I get some text but it only does the copy if I click twice. First time it leaves the old value.
I basically process set some text, process the value in PHP which returns a new value which I want to copy to clipboard. But it always doesn't pick up the first time. Is there a way to make it wait until $scope is ready. Tried various timeout, scope.apply methods but couldn't get it to work.

    $scope.getTextToCopy = function() {
        return $scope.rez;
    };

    $scope.copyCode = function(show_id) {
      var textToCopy = "12345"
        $http({
            headers: {
              'Content-Type': 'application/x-www-form-urlencoded'
            },
            url: 'snippets/scripts/iframeObfuscate.php',
            method: "POST",
            data: $.param({
                "param": textToCopy
            })
        }).success(function(data) {
            $scope.rez = data;
        });
    };

Any advice is appreciated :)

p.s best bet is to invoke a method to copy in js file and not use the
data-clip-copy="getTextToCopy()" in html. I think that would solve the issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants