当前位置: 移动技术网 > IT编程>脚本编程>AngularJs > Bootstrap和Angularjs配合自制弹框的实例代码

Bootstrap和Angularjs配合自制弹框的实例代码

2018年05月11日  | 移动技术网IT编程  | 我要评论

指令

directive('bspopup', function ($parse) {
return {
require: 'ngmodel',
restrict: 'a',
link: function (scope, elem, attrs, ctrl) {
scope.$watch(function () {
return $parse(ctrl.$modelvalue)(scope);
}, function (newvalue) {
if (newvalue ==0) {
$(elem).modal('hide');
return;
}
if (newvalue == 1) {
$(elem).modal('show');
return;
}
});
}
}
});
<button class="btn btn-xs btn-warning" data-target="#mymodal" data-toggle="modal" ng-click="sss()">弹框</button>
<div aria-hidden="true" aria-labelledby="mymodallabel" role="dialog" tabindex="-1" class="modal fade" bs-popup="" ng-model="test"
id="mymodal" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header alert-info">
<button aria-hidden="true" data-dismiss="modal" class="close" type="button">×</button>
<h4 id="mymodallabel" class="modal-title">弹框</h4>
</div>
<div class="modal-body">
<button class="btn btn-info" ng-click="hhh()">测试</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>

以上所述是小编给大家介绍的bootstrap和angularjs配合自制弹框,希望对大家有所帮助

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网