Labels

Ubuntu (5) Jax-RS (4) angular.js (4) java (4) linux (4) Jersey (3) classloader (3) javascript (3) Angular-UI (2) Eclipse (2) Google Chrome (2) Liferay (2) RAD 7.0 (2) SSL (2) WAS 6.1 (2) ATI Radeon 2600 (1) Apache (1) Axis (1) Birt (1) Bootstrap3 (1) CORS (1) CompizConfig (1) Finder (1) Generator (1) Google Docs (1) Grunt.js (1) JAX-RPC (1) Junit (1) Liferay javascript (1) MySQL (1) Power Mock (1) Python (1) Rest client (1) Service Builder (1) Subclipse (1) Unity (1) Virtual Host (1) Web Services (1) WebGL (1) WebStorm (1) bash (1) drivers (1) ext plugin (1) jvm (1) node.js (1) openVZ (1) play framework (1) validation (1) yeoman (1) yo (1)
Showing posts with label Angular-UI. Show all posts
Showing posts with label Angular-UI. Show all posts

May 11, 2014

Translate Angular-UI DatePicker - text and popup buttons too

You might want to Angular-UI date picker in your own language instead of default english.
Fortunately, guys at Angular-UI team did the job well and used i18n angular system.

All you have to do is to include the correct language pack :

...
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.js"></script>
<script src="https://code.angularjs.org/1.0.2/i18n/angular-locale_fr-fr.js"></script>
...


There's still the popup action buttons that are not translated.
As stated in the doc, you can configure the text displayed in those buttons by altering the datepickerPopupConfig global object default values :


// INJECT GLOBAL DATE PICKER POPUP CONFIG
var DatepickerDemoCtrl = function ($scope, datepickerPopupConfig) {
...
// TRANSLATION HERE
datepickerPopupConfig.currentText = 'Aujourd\'hui';
datepickerPopupConfig.clearText = 'Effacer';
datepickerPopupConfig.closeText = 'Fermer';
...
}
Here's a Plunkr for demoing purpose.

Hope this help !

March 18, 2014

Angular JS : Angular-UI modals won't show up with Bootstrap 3

While migrating from Bootstrap 2 to 3 in an angular jS app, realized there was a bug in modals implementation : Angular-UI directive doesn't add a "display block" CSS prop to the built modal, so it will never show up.

To fix it, simply add the following CSS :

/*
FIX ui-bootstrap modals + bootstrap 3
*/ .modal.ui-bootstrap-modal {   display: block; }
And open the modals this way :
$scope.openTheModal = function () {
$modal.open({
templateUrl: 'myModalTemplate.html',
scope: $scope,
windowClass: 'ui-bootstrap-modal'
});
};
Here we add a different class from the regular 'modal' class. Reason is : in my app I had both plain Bootstrap3 modals and angular-UI modals. Simply adding display: block property on 'modal' class was breaking regular Bootstrap 3 modals.

Hope this help.