ui.bootstrap模式加载HTML但不显示任何 [英] ui.bootstrap modal loading html but not showing anything

查看:214
本文介绍了ui.bootstrap模式加载HTML但不显示任何的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其放入口模态指定的加载也模板。但没有显示任何东西。

Its loading opening modal and also loading template specified. But not showing anything.

在这里查看演示: http://demo.hupp.in/food-admin

转到[产品]和搜索EnegiKcal> = 3500。然后单击管理。这将打开弹出,但没有加载模板内容。

Go to [Products] and Search EnegiKcal >= 3500. Then click on manage. It will open pop up but template content is not loaded.

此外,我注意到另一件事是,它返回的 HTTP 304 作为模板的时候。

Also one other thing I noticed is that it returns HTTP 304 for template sometimes.

这是怎么打开模式:

/** Open Modal For add edit tags */
$scope.open = function (productId) {

    var modalInstance = $modal.open({
        templateUrl: 'views/some.html',
        controller: tagsModalInstanceCtrl,
        size: 'lg'
    });

    modalInstance.result.then(function (msg) {

    }, function () {
        // $log.info('Modal dismissed at: ' + new Date());
    });

};  

var tagsModalInstanceCtrl = function ($scope, $modalInstance) {

    $scope.ok = function () {
        $modalInstance.close("hi");
    };

    $scope.cancel = function () {
        $modalInstance.dismiss('cancel');
    };
};

下面是模板code:

<div class="modal-header">
   <h3 class="modal-title">I'm a modal!</h3>
</div>
<div class="modal-body">
   <h3>Well, Hello there!</h3>
</div>
<div class="modal-footer">
    <button class="btn btn-primary" ng-click="ok()">OK</button>
    <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>

推荐答案

好吧,这是pretty奇怪,但似乎你的模板是基于的https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html

Ok, it is pretty strange but it seems that your template is based on the master branch of https://github.com/angular-ui/bootstrap/blob/master/template/modal/window.html

和您的标记源0.11。

and your sources on the tag 0.11.

https://github.com/棱角分明的UI /引导/ BLOB / 0.11.0 / src目录/莫代尔/ modal.js

当您在控制台输入$('模式内容),它是可见的,你会看到,它需要一个模式,transclude指令,但在资源没有这个指令的痕迹。因为,它0.11直接采用NG-transclude指令,它是角部分。

It is visible when you type $('.modal-content') in the console, you will see that it needs a modal-transclude directive, but in the sources there is no trace of this directive. Because, on 0.11 it directly uses the ng-transclude directive which is part of angular.

所以,你的code是正确的,但的lib是没有,尝试获取它的一个正确的版本(也许他们的回购协议的最后版本被打破)

So, your code is correct, but the lib is not, try retrieving a correct version of it (maybe the last build of their repo is broken)

这篇关于ui.bootstrap模式加载HTML但不显示任何的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆