我需要打开模式弹出窗口,同时用户将在uaular上单击Angular.js按钮,但第一次单击该按钮,而在关闭时再次单击模式以打开其未打开的窗口。总体而言,该弹出窗口每两次单击一次按钮间隔即可打开。
检查我的以下代码到目前为止我已经尝试过的内容。
<td>
<a ui-sref='app.ownerinfo.owner.vew'>
<input type='button' class='btn btn-xs btn-green'
value='Edit' ng-click="editOwnerData(usr.owner_id);">
</a>
</td>
<modal title="Owner Information" visible="showModalOwner">
<p>MOdal Window</p>
</modal>
$scope.editOwnerData=function(owner_id){
$scope.showModalOwner = !$scope.showModalOwner;
}
dashboard.directive('modal', function () {
return {
template: '<div class="modal fade">' +
'<div class="modal-dialog modal-lg">' +
'<div class="modal-content">' +
'<div class="modal-header">' +
'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>' +
'<h4 class="modal-title">{{ title }}</h4>' +
'</div>' +
'<div class="modal-body" ng-transclude></div>' +
'</div>' +
'</div>' +
'</div>',
restrict: 'E',
transclude: true,
replace:true,
scope:false,
link: function postLink(scope, element, attrs) {
scope.title = attrs.title;
scope.$watch(attrs.visible, function(value){
if(value == true)
$(element).modal('show');
else
$(element).modal('hide');
});
$(element).on('shown.bs.modal', function(){
scope.$apply(function(){
scope.$parent[attrs.visible] = true;
});
});
$(element).on('hidden.bs.modal', function(){
scope.$apply(function(){
scope.$parent[attrs.visible] = false;
});
});
}
};
});
在这里,每次单击按钮时我都需要打开弹出窗口,单击两次后现在应该打开该窗口。