Search code examples
angularjsangular-translate

angular: how to config the service independently for different modules?


In the same app I have 2 modules: module1 and module2.

I am trying to integrate angular-translate to have have independent vocabularies for each module.

For such purpose I'm using custom loader service.

I insert $translateProvider.useLoader('some service loader name') into config section(for each module). There are two different custom loaders in each module with unique names. But it seems for me that there is only one translate service instance through all the application.

I'm not sure is it right. If so and I am able to have only one service instance in the moment (how) is it possible to configure service independently for each module?


Solution

  • Actually Angular 1.x definitely instantiates services only once per life cycle(https://docs.angularjs.org/guide/services) So there is no chances to create several instances and to initialize them independently. As far as I know it's changed in Angular 2.x