2

For a project I had to add custom behavior to UI Bootstrap's Datepicker.

I had to add new key-value pairs to the datepickerConfig constant, had to do some simple changes in the DatepickerController, add a new directive and change some templates.

Everything works fine, but now I would like to extract my changes, to leave the original UI Bootstrap source untouched, so it can be updated by Bower.

Changing the templates were straightforward, as I could simply add/overwrite files in the template cache with .run from any other module.

.run(['$templateCache', function($templateCache) {
    //...
}])

But when I try to change the config constant or add a new directive from an external file to the UI Bootstrap Datepicker module, everything breaks:

angular.module('ui.bootstrap.datepicker')
    .constant('datepickerConfig', {
        //...
    })
    .directive('myNewDirective', {
        //...
    })

I tried to extract the whole complete module into an external file, and load it after UI bootstrap, but it didn't work either.

What is the proper Angular way of doing this?

orszaczky
  • 13,301
  • 8
  • 47
  • 54

0 Answers0