Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

http get not resolving success on AngularJS 1.1.4 #2700

Closed
Elecash opened this issue May 18, 2013 · 4 comments
Closed

http get not resolving success on AngularJS 1.1.4 #2700

Elecash opened this issue May 18, 2013 · 4 comments

Comments

@Elecash
Copy link

Elecash commented May 18, 2013

Hi,

I think that I found a bug. I have an http.get().success() that is not resolving on 1.1.4 but it does on 1.0.6.

This happens to me inside a Factory, this is my sample code:

app.factory("ForecastAPI",
    function($http)
    {
        return {
            URL: "https://api.forecast.io/forecast/<FORECAST_API_KEY>/",
            getWeather: function(lat, lon, callback)
            {
                var url = this.URL + lat + "," + lon;

                $http.get(url).success(
                    function(response)
                    {
                        callback(response);
                    }
                );
            }
        }
    }
);

This is executing in a resolve function from $routeProvider.

Hope it helps.

Raul

@vendethiel
Copy link

I believe this is a dup of #2438

@Elecash
Copy link
Author

Elecash commented May 18, 2013

Yes it is, the problem here is that I can't access to $scope inside a resolve function from $routeProvider, or at least, I can't.

@pkozlowski-opensource
Copy link
Member

@Elecash You can always inject $rootScope everywhere you can inject $http. But I'm not sure why you would need $apply in the routing resolve part.

Going to close this one for now as duplicate of #2438 but feel free to re-open if you still face problems. In that case be sure to provide a minimal reproduce scenario using http://plnkr.co/

@Elecash
Copy link
Author

Elecash commented Aug 4, 2013

Sure, no problem, thanks for your support.

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

No branches or pull requests

3 participants