由于某些原因,模式框工作得很好,但它不会加载我指定的任何模板。
我的控制器有这个代码;
var brnSearchModal = $modal({ scope: $scope, template: "app/rrn/searchBrn.html", contentTemplate: false, html: true, show: false });
$scope.showModal = function () {
brnSearchModal.$promise.then(brnSearchModal.show);
};我的HTML看起来像这样;
<button data-ng-click="showModal()" type="button" class="btn btn-info" data-animation="am-fade-and-slide-top">
BRN Lookup
</button>我的模板在一个文件中,看起来像这样;
<div class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header" ng-show="title">
<button type="button" class="close" ng-click="$hide()">×</button>
<h4 class="modal-title" ng-bind="title">Hello, World!</h4>
</div>
<div class="modal-body" ng-bind="content">Lorem ipsum dolor.</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="$hide()">Close</button>
</div>
</div>
</div>
</div>没有错误,看起来一切都很好,但是模板没有加载。如果我在某一时刻调试angular-strap,模板会被加载,但随后会在中消失,留下一个空白的模式。
发布于 2015-04-01 00:00:21
从模板中删除ng-show="title"和ng-bind="title"。
发布于 2014-07-31 19:15:02
尝试添加bs-modal属性:请参阅examples
<button data-ng-click="showModal()" type="button" class="btn btn-info" data-animation="am-fade-and-slide-top" bs-modal="brnSearchModal">
BRN Lookup
</button>否则,直接使用data-template属性,而不使用JS来显示模式:
<button type="button" class="btn btn-info" data-animation="am-fade-and-slide-top" data-template="app/rrn/searchBrn.html" bs-modal="modal">
BRN Lookup
</button>我认为当你把bs-modal="modal"放在angular-strap库中时,modal在某种程度上是预定义的。
发布于 2015-10-14 15:25:22
您应该从模板中删除ng-show="title“、ng-show="content"或ng-bind="title"。请确保模板中没有ng-show。
https://stackoverflow.com/questions/24942636
复制相似问题