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

Throwing http exception #114

Open
milindCODEROR opened this issue Aug 18, 2017 · 3 comments
Open

Throwing http exception #114

milindCODEROR opened this issue Aug 18, 2017 · 3 comments

Comments

@milindCODEROR
Copy link

milindCODEROR commented Aug 18, 2017

As per the document, I implemented the localization but its throwing the below exception
TypeError: $http.get(...).success is not a function

I am using angular: 1.6.x version

@doshprompt
Copy link
Owner

Can you give an example of your code?

@alphatwit
Copy link

It's because Angular 1.6 doesn't support .success. you have to use .then

https://stackoverflow.com/questions/41169385/http-get-success-is-not-a-function

@angel1st
Copy link

angel1st commented Jul 10, 2018

@doshprompt - what you should do is to replace your $http.get(...) call at line 106 with following code:

                    $http.get(url)
                        .then(function (data) {
                            var key,
                                path = getPath(token);
                            // Merge the contents of the obtained data into the stored bundle.
                            for (key in data) {
                                if (data.hasOwnProperty(key)) {
                                    root[key] = data[key];
                                }
                            }

                            // Mark the bundle as having been "loaded".
                            delete root._loading;

                            // Notify anyone who cares to know about this event.
                            $rootScope.$broadcast(localeEvents.resourceUpdates);

                            // If we issued a Promise for this file, resolve it now.
                            if (deferrences[path]) {
                                deferrences[path].resolve(path);
                            }
                        }, 
                        function (data) {
                            $log.error("[localizationService] Failed to load: " + url);

                            // We can try it again later.
                            delete root._loading;
                        });

and since the pull request is already made, it shouldn't be a hard to be implemented, I guess....

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

4 participants