Bootstrap與Angularjs的模態(tài)框?qū)嵗a
更新時間:2017年08月03日 13:29:31 作者:醉小義
這篇文章主要介紹了Bootstrap與Angularjs的模態(tài)框?qū)嵗a,需要的朋友可以參考下
先給大家展示下效果圖,感興趣的朋友參考下實現(xiàn)代碼吧
效果圖如下所示:

具體代碼如下所示:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script src="https://cdn.bootcss.com/angular.js/1.4.6/angular.min.js"></script>
<link rel="stylesheet" rel="external nofollow" >
<script src="https://cdn.bootcss.com/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script >
angular.module("myApp",[]).controller("myControl",["$scope",function($scope){
$scope.fun = function(){
$('#basic').modal('show');
}
$('#basic').on('hidden.bs.modal', function () { //模態(tài)框取消時觸發(fā)的事件
// 執(zhí)行一些動作...
alert("sadsfsdfds");
})
}]);
</script>
</head>
<body ng-app="myApp" ng-controller="myControl">
<div class="modal fade" id="basic" tabindex="-1" role="basic" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="title">
模態(tài)框的標題
</h4>
</div>
<div class="modal-body">
文本內(nèi)容
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">關閉</button>
<button type="button" class="btn btn-primary">提交更改</button>
</div>
</div>
</div>
</div>
<!--
兩種方式去調(diào)用模態(tài)框
-->
<button type="button" ng-click="fun()">模態(tài)框</button>
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#basic">
開始演示模態(tài)框
</button>
<!--
data-target="#myModal" 是您想要在頁面上加載的模態(tài)框的目標。您可以在頁面上創(chuàng)建多個模態(tài)框,然后為每個模態(tài)框創(chuàng)建不同的觸發(fā)器。
您可以在頁面上創(chuàng)建多個在不同時間進行加載。
-->
</body>
</html>
總結(jié)
以上所述是小編給大家介紹的Bootstrap與Angularjs的模態(tài)框?qū)嵗a,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
相關文章
詳解Angular 4.x NgTemplateOutlet
這篇文章主要介紹了詳解Angular 4.x NgTemplateOutlet,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-05-05
AngularJS ng-repeat指令中使用track by子語句解決重復數(shù)據(jù)遍歷錯誤問題
這篇文章主要介紹了AngularJS ng-repeat指令中使用track by子語句解決重復數(shù)據(jù)遍歷錯誤問題,結(jié)合實例形式分析了ng-repeat指令遍歷JavaScript數(shù)組錯誤的原因與相關解決技巧,需要的朋友可以參考下2017-01-01
BootStrap+Angularjs+NgDialog實現(xiàn)模式對話框
在完成一個后臺管理系統(tǒng)時,需要用表格顯示注冊用戶的信息。但是用戶地址太長了,不好顯示。所以想做一個模式對話框,點擊詳細地址按鈕時,彈出對話框,顯示地址。下面小編給大家分享下實現(xiàn)方法,一起看下吧2016-08-08

