How to extend ui boot controller

I have included the bootstrap ui module in my angular project, and now I want to expand, for example, the dump controller “UibDatepickerController” into “ui-bootstrap-tpls.js” with additional functions.

Well, I could edit the ui bootstrap file, but that is not what I want.

I need a file with modules (perhaps my own directive), so there is no big problem when an ui bootstrap update arrives.

Is it possible? What is the practice?

+5
source share
1 answer

You can try entering $controller and last as follows:

 app.directive('myUiDirective', function ($controller) { return { link: function (scope, iElem, iAttr) { angular.extend(this, $controller('UibDatepickerController', {$scope: scope})); } }); 

However, I'm not sure if you can get the controller from another module (in this case, from ui.bootstrap ).

0
source

Source: https://habr.com/ru/post/1235777/


All Articles