bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

[Feature request] Support $uibmodal.open windowTemplate option

Open Sn0wFox opened this issue 7 years ago • 1 comments

Hi, According to the current doc, $uibmodal.open() supports the option windowTemplateUrl but not something like windowTemplate. However, it supports templateUrl and template as well.

My app is fully bundled with webpack and I'd like to bundle my window's template as well instead of having an extra http request just for that (I can still do something about it using ng-cache-loader but it just doesn't feel right.

It would look something like that:

$uibModal.open({
  template: require('./some.tpl.html'),
  windowTemplate: require('./window.tpl.html')
})

instead of

$uibModal.open({
  template: require('./some.tpl.html'),
  windowTemplateUrl: 'path/to/window.tpl.html'
})

Is there any reason to not provide such an option when template and templateUrl are fully supported ?

Sn0wFox avatar Jul 11 '17 11:07 Sn0wFox

Would love to see this as well

EDIT:

I've got a nice workaround for this, if you're still interested @Sn0wFox .

You can put the template in the angulare template cache, and require it there:

angular.module("yourModule").run(["$templateCache", function($templateCache) {
  $templateCache.put("window.tpl.html.", require('../path/to/window.tpl.html'));
}]);

You can then just pass it to uibModal.open as follows:

$uibModal.open({
  template: require('./some.tpl.html'),
  windowTemplateUrl: 'window.tpl.html'
});

joelchrist avatar Mar 14 '19 06:03 joelchrist