Bootstrap和Angularjs配合自制弹框的实例代码
程序员文章站
2023-11-18 15:14:58
指令
directive('bspopup', function ($parse) {
return {
require: 'ngmodel',
restr...
指令
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配合自制弹框,希望对大家有所帮助
上一篇: 怎样在网页设计中做出精彩的文字排版?
下一篇: 字体设计教程:字体的阴阳收缩法介绍