Angular UI Bootstrap modal - use custom modal window

落花浮王杯 提交于 2019-12-02 08:53:16

windowTemplateUrl is a template for window decoration: https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html

You still need to supply modal's content (using template or templateUrl) that you would like to see decorated.

This is how windowTemplateUrl is working

$scope.open = function () {

var modalInstance = $modal.open({
  templateUrl:'myModalContent.html',
  windowTemplateUrl: 'customModal.html',
  controller: 'ModalInstanceCtrl',
  resolve: {
  params: function(){
     return {
        title: 'Custom title 2'
           };
         }
      }
   });
};

Original version of angular-ui (not working)

Modificated version of angular-ui (working)

Pavel Voronin

First, you should use either base tag in you html documents or do not use relative urls.

Angular does not know about virtual directories so when path to you site looks like mysite.com/MySite there is a chance of getting into troubles.

pkozlowski.opensource has already given you an answer. Be also aware that you can provide an id of template instead of real url if you'd like to. In that case template must be declared like this:

<script type="text/ng-template" id="TemplateId">
    ...template...
</script>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!