How can I translate text in Bootstrap UI pagination directive?
I've overrided the constants like this for french translation:
angular.module('myapp', ['ui.bootstrap'])
.constant('paginationConfig', {
itemsPerPage: 10,
boundaryLinks: false,
directionLinks: true,
firstText: 'Premier',
previousText: 'Précédent',
nextText: 'Suivant',
lastText: 'Dernier',
rotate: true
})
But overriding constants seems to be a bad idea...
What is the correct way (if any) to do this?
Rather than overiding the whole constant object you can modify properties of it within the run
method
var app=angular.module('myapp', ['ui.bootstrap']);
app.run(function(paginationConfig){
paginationConfig.firstText='MY FIRST';
paginationConfig.previousText='YOUR TEXT';
})
DEMO
In new version of ui.bootstrap
you should use
uibPaginationConfig
insted of
paginationConfig
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With