Javascript 角带模式不加载模板
出于某种原因,模态框工作正常,但它不加载我指定的任何模板 我的控制器有这个代码Javascript 角带模式不加载模板,javascript,angularjs,twitter-bootstrap,angular-strap,Javascript,Angularjs,Twitter Bootstrap,Angular Strap,出于某种原因,模态框工作正常,但它不加载我指定的任何模板 我的控制器有这个代码 var brnSearchModal = $modal({ scope: $scope, template: "app/rrn/searchBrn.html", contentTemplate: false, html: true, show: false }); $scope.showModal = function () { brnSearchModal.$promise.then(brnSearchM
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>
BRN查找
我的模板在一个文件中,看起来像这样
<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>
&时代;
你好,世界!
洛雷姆·伊普苏姆·多洛。
接近
没有错误,一切正常,但模板未加载。如果在某一点调试角带,则会加载模板,但随后消失,并留下一个空白模式。尝试添加bs模式属性:请参阅
BRN查找
否则,直接使用数据模板属性,而不使用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>
BRN查找
我认为,当您将
bs modal=“modal”
模式以某种方式预先定义在角带库中。从模板中删除ng show=“title”
,ng bind=“title”
。您应该从模板中删除ng show=“title
,ng show=“content”
或ng bind=“title”
。您应该确保模板没有ng show
我知道这是一个老问题,但万一其他人正在寻找解决同一问题的方法。我发现在将模板设置为html字符串时,必须将templateUrl显式设置为falsy如果要显示模式标题,请删除ng bind html=“title”