Bootstrap和Angularjs配合自制彈框的實(shí)例代碼
指令
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配合自制彈框,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
- js+html5實(shí)現(xiàn)半透明遮罩層彈框效果
- vue.js中toast用法及使用toast彈框的實(shí)例代碼
- js自定義彈框插件的封裝
- 輕松實(shí)現(xiàn)js彈框顯示選項(xiàng)
- vue.js實(shí)現(xiàn)只彈一次彈框
- js實(shí)現(xiàn)上下左右彈框劃出效果
- 基于layer.js實(shí)現(xiàn)收貨地址彈框選擇然后返回相應(yīng)的地址信息
- javascript實(shí)現(xiàn)無法關(guān)閉的彈框
- js重寫alert事件(避免alert彈框標(biāo)題出現(xiàn)網(wǎng)址)
- JavaScript單例模式實(shí)現(xiàn)自定義彈框
相關(guān)文章
詳解Angular中實(shí)現(xiàn)自定義組件的雙向綁定的兩種方法
這篇文章主要介紹了詳解Angular中實(shí)現(xiàn)自定義組件的雙向綁定的兩種方法,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2018-11-11全面解析Angular中$Apply()及$Digest()的區(qū)別
$apply()和$digest()在AngularJS中是兩個核心概念,但是有時候它們又讓人困惑。這篇文章主要介紹了Angular中$Apply()及$Digest()區(qū)別詳細(xì)說明的相關(guān)資料,需要的朋友可以參考下2016-08-08Angular.js中ng-include用法及多標(biāo)簽頁面的實(shí)現(xiàn)方式詳解
這篇文章主要給大家介紹了在Angular.js中ng-include用法及多標(biāo)簽頁面的實(shí)現(xiàn)方式的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),相信對大家具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編一起來學(xué)習(xí)學(xué)習(xí)吧。2017-05-05Angular搜索 過濾 批量刪除 添加 表單驗(yàn)證功能集錦(實(shí)例代碼)
這篇文章主要介紹了Angular搜索 過濾 批量刪除 添加 表單驗(yàn)證功能集錦(實(shí)例代碼),需要的朋友可以參考下2017-10-10基于AngularJS實(shí)現(xiàn)的工資計(jì)算器實(shí)例
這篇文章主要介紹了基于AngularJS實(shí)現(xiàn)的工資計(jì)算器,結(jié)合具體實(shí)例形式分析了AngularJS數(shù)值計(jì)算相關(guān)操作技巧,需要的朋友可以參考下2017-06-06AngularJS基礎(chǔ)學(xué)習(xí)筆記之指令
指令(Directives)是所有AngularJS應(yīng)用最重要的部分。盡管AngularJS已經(jīng)提供了非常豐富的指令,但還是經(jīng)常需要創(chuàng)建應(yīng)用特定的指令。這篇教程會為你講述如何自定義指令,以及介紹如何在實(shí)際項(xiàng)目中使用。2015-05-05AngularJS實(shí)現(xiàn)的獲取焦點(diǎn)及失去焦點(diǎn)時的表單驗(yàn)證功能示例
這篇文章主要介紹了AngularJS實(shí)現(xiàn)的獲取焦點(diǎn)及失去焦點(diǎn)時的表單驗(yàn)證功能,涉及AngularJS使用ng-blur、ng-focus針對表單事件監(jiān)聽相關(guān)操作技巧,需要的朋友可以參考下2017-10-10