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

change locale globally, with angular.config #29

Closed
CaledoniaProject opened this issue Nov 30, 2015 · 2 comments
Closed

change locale globally, with angular.config #29

CaledoniaProject opened this issue Nov 30, 2015 · 2 comments

Comments

@CaledoniaProject
Copy link

Hi,

I'm trying to do something like this,

app.config(['ngBootbox', function(ngBootbox) {
   ngBootbox.setLocale ('xxx');
}]);

But angular does not run with it, any ideas? Already added ngBootbox as dependencies, and it works great.

Now I just need to avoid setting the locale in every controllers ...

eriktufvesson added a commit that referenced this issue Dec 1, 2015
@eriktufvesson
Copy link
Owner

Hi,

A provider is now added in v0.1.3 of ngBootbox.

You can use it like this:

angular.module('yourApp')
    .config(function($ngBootboxConfigProvider) {
        $ngBootboxConfigProvider.setDefaultLocale('sv');

        $ngBootboxConfigProvider.addLocale('ex', { OK: 'OK', CANCEL: 'Avbryt', CONFIRM: 'Bekräfta' });

        $ngBootboxConfigProvider.removeLocale('ex');
     })
     .controller('TestCtrl', function($ngBootboxConfig) {
        var defaultLocale = $ngBootboxConfig.getDefaultLocale();  
     });

@CaledoniaProject
Copy link
Author

great job! Just applied to my project

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

2 participants