1

I'm using IonicFramework to create a mobile app and I want to set the back button text to "Back", but since my app is in several languages I'm using the $translate service to translate the "Back" string to the proper language

This crashes the app since services aren't allowed to be injected in the app.config block.

Any ideas how to solve it? Here is my code:

app.config(function($ionicConfigProvider, $translate) {

  $translate('label_back').then(function(translation){
     $ionicConfigProvider.backButton.text(translation);
  });

});
Weblurk
  • 6,562
  • 18
  • 64
  • 120
  • You can use service and provide in app.run method.I think service can not be use able in config. – Charnjeet Singh Aug 19 '15 at 10:33
  • you can't inject service in config function but you can do it by implementing resovle function in config as `resolve: { data: function (dbService) { return dbService.getData(); } }` – Anil kumar Aug 19 '15 at 10:37
  • @Anilkumar How would I write your suggested function applied to my example? – Weblurk Aug 19 '15 at 10:41
  • Please have a look in this [link](http://stackoverflow.com/questions/15937267/inject-service-in-app-config) for reference – Anil kumar Aug 19 '15 at 10:51

0 Answers0