Bootstrap和Angularjs配合自制弹框的实例代码
2016-08-24 11:15
846 查看
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配合自制弹框,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对脚本之家网站的支持!
您可能感兴趣的文章:
相关文章推荐
- Bootstrap+Angularjs自制弹框
- AngularJS 与Bootstrap实现表格分页实例代码
- Bootstrap与Angularjs的模态框实例代码
- AngularJS Bootstrap详细介绍及实例代码
- Bootstrap弹出带合法性检查的登录框实例代码【推荐】
- Bootstrap弹出带合法性检查的登录框实例代码【推荐】
- 第七篇Bootstrap表单布局实例代码详解(三种表单布局)
- el表达式 写入bootstrap表格数据页面的实例代码
- AngularJS 模型详细介绍及实例代码
- BootStrap创建响应式导航条实例代码
- BootStrap中Tab页签切换实例代码
- Bootstrap下拉菜单效果实例代码分享
- JBox弹框插件应用实例代码
- try catch finally 的用法,你知道多少?最详细、最到位的讲解,配合代码实例讲解,让你轻松掌握和理解
- AngularJS 实现按需异步加载实例代码
- 第八篇Bootstrap下拉菜单实例代码
- 第八篇Bootstrap下拉菜单实例代码
- Apache Shiro+SpringMVC+Hibernate Search+Hibernate+Bootstrap企业信息管理系统基础框架搭建整合实例代码教程
- AngularJS使用ngOption实现下拉列表的实例代码
- 第七篇Bootstrap表单布局实例代码详解(三种表单布局)