Skip to content

Circular dependency when using inside $http interceptor #138

Description

@suhrab

This article http://blog.altoros.com/speed-up-i18n-in-angularjs.html
describes how to speed up angular applications that heavily use translate libraries like this one. Article gives example for angular-translate. I wanted it work with angular-gettext.

In example they use $translate service from angular-translate as dependency to factory that creates request interceptor. It works.

I replaced $translate with gettextCatalog, but now I get an error from angular about circular dependency: https://docs.angularjs.org/error/$injector/cdep?p0=$http%20%3C-%20gettextCatalog%20%3C-%20translateHttpInterceptor%20%3C-%20$http%20%3C-%20$templateFactory%20%3C-%20$view%20%3C-%20$state

The problem:
angular-gettext factory 'gettextCatalog' depends on $http (loadRemote method). if I remove this dependency and 'loadRemote' method, everything works fine.

Actually I think that angular-gettext should not depend on $http, it is very easy to write my own loading from remote method using $http and 'gettextCatalog.setStrings'.

angular-translate does not depend on $http

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions