我有4个按钮,它们调用模态引导程序窗口,当我这样做时,函数加载带有$ scope变量的html-temptale,但是模态窗口不适用于$ scope,我之前问过这个问题并且有回答使用指令,但坦率地说我不明白它是如何工作的,这是一个例子
<div class="infBox" data-toggle="modal" data-target="#myModal" ng-click="modal('Modals/modal2', row.Name)">
<h4>BUILD</h4>
<div>
<img ng-class="{opac: row.Commit.Build.Debug == false}" src="IMG/computer-md.png">
<img ng-class="{opac: row.Commit.Build.Release == false}" src="IMG/computer-md.png">
</div>
<span class="debug">Debug</span><span>Release</span>
<span class="time">{{row.Commit.Build.Timefin}}</span>
</div>
这是div按钮
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
</div>
</div>
</div>
</div>
这是模态窗口
$scope.modal = function(path, name){
$scope.ModalObj = $scope.Objects[FindNumber(name, $scope.Objects)];
$http.get(path).success(function(data) {
$scope.modalData = data;
});
};
这是一个加载temptale的函数
<h4>BUILD</h4>
<div>
<img ng-class="{opac: ModalObj.Commit.Build.Debug == false}" src="IMG/computer-md.png">
<img ng-class="{opac: ModalObj.Commit.Build.Release == false}" src="IMG/computer-md.png">
</div>
<span class="debug">Debug</span><span>Release</span>
<span class="time">{{ModalObj.Commit.Build.Timefin}}</span>
这是暂时的
答案 0 :(得分:1)
这是你的最后一篇帖子,Nishi建议你很好!
Problems with modal and ng-bind-html
如果你不明白,那么请考虑一些建议。
As Nishi发布在你的上一篇文章中,我会做得很好,你只需要换几行。
writeYourAppName.directive('modal', function () {
return {
template: 'Your Modal Window Code',
并使用控制器将值传递给模型
答案 1 :(得分:1)
您可能需要使用angular-ui modal。