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

$http.jsonp(...).success is not a function angularjs. Any idea how to integrate with API by overcoming this error?? #6

Open
Sahanaa opened this issue Jun 28, 2017 · 1 comment

Comments

@Sahanaa
Copy link

Sahanaa commented Jun 28, 2017

This typescript error occurs while integrating with Yahoo API. I think this doesn't work with angularjs ^1.4.0.

Check the code below -

     `$http.jsonp(url + '&callback=JSON_CALLBACK')
       .success(function (data) {
      if (data.query.count) {
        var quotes = data.query.count > 1 ? data.query.results.quote : [data.query.results.quote];
        update(quotes);
        }
    })	
    .error(function (data) {
    	console.log("error");
      console.log(data);
    });`
@Ekus
Copy link

Ekus commented Apr 18, 2018

in angularjs 1.6+ jsonp() no longer supports .success() and .error() methods, but instead single method .then(successCallback, errorCallback) (or like this: .then(function(response){...}, function(response){...}); )

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

2 participants