angularjs模態(tài)框的使用代碼實(shí)例
這篇文章主要介紹了angularjs模態(tài)框的使用代碼實(shí)例,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
編寫html頁(yè)面
1.觸發(fā)模態(tài)框的點(diǎn)擊事件
<div> <button type="button" class="btn btn-primary" ng-click="openAddModal()" data-toggle="modal" data-target="#documentOprModal" style="margin-left: 10px;float:left"> <i class="glyphicon glyphicon-plus"></i>{{ 'i18n.add' | translate }} </button> </div>
2.模態(tài)框頁(yè)面
<div class="modal fade" id="documentOprModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" data-backdrop="static" data-keyboard="false"> <div class="modal-dialog modal-lg" role="document" style="width: 600px;"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title" id="myModalLabel"> 文檔入庫(kù)</h4> </div> <div class="modal-body"> <!--開發(fā)--> <form name="docForm" id="docForm" novalidate> <!-- 分類 --> <div class="form-group"> <label class="col-lg-12 col-md-12 col-xs-12" style="padding: 0;">分類:</label> <div class="input-group col-lg-12 col-md-12 col-xs-12"> <div class="input-group"> <input type="text" ng-model="document.classification_name" class="form-control" placeholder="選擇分類"> <div class="input-group-btn"> <button type="button" class="btn btn-default" style="height: 30px" ng-click="toggleDetail()"> <span class="caret"></span></button> </div> </div> <div ng-show="isShowDetail" style="position: absolute;z-index: 9999;width: 560px;"> <div class="panel panel-default"> <div class="panel-body list-group list-group-contacts"> <div> <ul id="classify-tree" class="ztree"></ul> </div> </div> </div> </div> </div> </div> <!-- 星級(jí) --> <div class="form-group"> <label class="col-lg-12 col-md-12 col-xs-12" style="padding: 0;">星級(jí):</label> <div class="input-group col-lg-12 col-md-12 col-xs-12"> <ui-select ng-model="document.starGrade" theme="selectize"> <ui-select-match placeholder="請(qǐng)選擇星級(jí)"> <span ng-bind="$select.selected.name"></span> </ui-select-match> <ui-select-choices repeat="item.id as item in (starGrades | filter: $select.search) track by $index "> <div ng-bind-html="item.name | highlight: $select.search"></div> </ui-select-choices> </ui-select> </div> </div> <!-- 井號(hào) --> <div class="form-group"> <label for="jhText">井號(hào):</label> <input type="text" class="form-control" id="jhText" ng-model="document.jh"> </div> <!-- 作者 --> <div class="form-group"> <label for="authorText">作者:</label> <input type="text" class="form-control" id="authorText" ng-model="document.author"> </div> <!-- 單位 --> <div class="form-group"> <label for="unitText">單位:</label> <input type="text" class="form-control" id="unitText" ng-model="document.unit"> </div> <!-- 日期 --> <div class="form-group"> <label for="writeDate">寫作日期:</label> <input type="date" class="form-control" id="writeDate" ng-model="document.writeDate"> </div> <!-- 簡(jiǎn)介 --> <div class="form-group"> <label for="introductionTextArea">簡(jiǎn)介:</label> <textarea class="form-control" id="introductionTextArea" ng-model="document.introduction" rows="5" cols="60"></textarea> </div> <!-- 可能的查詢關(guān)鍵字 --> <div class="form-group"> <label for="keyPackageTextArea">可能的查詢關(guān)鍵字:</label> <textarea class="form-control" id="keyPackageTextArea" ng-model="document.keyPackage" rows="5" cols="60"></textarea> </div> <!-- 文件 --> <div class="form-group"> <div id="inputContent"> <input id="importFile" type="file" name="file" class="file-loading"> </div> </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary" ng-click="submitFileInfo()"><i class="fa fa-check"></i>{{ 'i18n.save' | translate }} </button> <button type="button" class="btn btn-default" data-dismiss="modal" style="margin: 0px 20px;"><i class="fa fa-ban"></i>{{ 'i18n.cancel' | translate }} </button> </div> </div> </div> </div>
3.編寫對(duì)應(yīng)的js
/** * 點(diǎn)擊 添加事件打開模態(tài)框 */ function openAddModal() { $('#documentOprModal').modal({ show: true, keyboard: false, backdrop: 'static' }); }
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
淺談JavaScript中小數(shù)和大整數(shù)的精度丟失
下面小編就為大家?guī)?lái)一篇淺談JavaScript中小數(shù)和大整數(shù)的精度丟失。小編覺得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-05-05小程序開發(fā)實(shí)戰(zhàn)指南之封裝自定義彈窗組件
最近在做公司的小程序項(xiàng)目,發(fā)現(xiàn)設(shè)計(jì)上有很多不統(tǒng)一,代碼上有很多冗余,下面這篇文章主要給大家介紹了關(guān)于小程序開發(fā)實(shí)戰(zhàn)指南之封裝自定義彈窗組件的相關(guān)資料,需要的朋友可以參考下2022-11-11javaScript call 函數(shù)的用法說(shuō)明
javaScript 中的 call() 是一個(gè)奇妙的方法,但也是一個(gè)讓人迷惑的方法,先看一下官方的解釋。2010-04-04javascript 中iframe高度自適應(yīng)(同域)實(shí)例詳解
這篇文章主要介紹了javascript 中iframe高度自適應(yīng)(同域)實(shí)現(xiàn)代碼的相關(guān)資料,需要的朋友可以參考下2017-05-05