国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

angularJS模態(tài)框$modal實(shí)例代碼

2024-05-06 15:16:40
字體:
供稿:網(wǎng)友

1.引入$modal模塊

如:angular.module('ModalCtrl',['$modal' ,'$scope' , function($modal ,$scope ){ }]);

2.執(zhí)行調(diào)模態(tài)框 函數(shù)

$scope.editModule = function(type, size, id) {   $scope.id = id;   var modalInstance = $modal.open({     templateUrl: 'tpl/weichat_modulebaseinfo.html', //template:'html元素模板',     controller: 'EditModuleCtrl', // 初始化模態(tài)范圍     size: size, //大小配置     scope: '一個作用域?yàn)槟B(tài)的內(nèi)容使用($modal會創(chuàng)建一個當(dāng)前作用域的子作用域,scope可有可無)默認(rèn)為$rootScope',     resolve: {       items: function() {         return $scope.id; //向模態(tài)框控制器中傳值       }     }     background: '', //控制背景,true(有) or false(無),static背景存在,但是點(diǎn)擊模態(tài)窗口之外,模態(tài)窗不關(guān)閉     keyboard: '', //按下Esc時,模態(tài)對話框是否關(guān)閉,默認(rèn)為ture     windowClass: '' //指定一個class并被添加到模態(tài)窗口中    });    modalInstance.result.then(function(selectedItem) { //模態(tài)框關(guān)閉后返回函數(shù),selectedItem為返回值    }) } 

3.創(chuàng)建模態(tài)框控制器

app.controller('EditModuleCtrl', ['$scope', '$modalInstance', 'BookService', '$stateParams', 'items', function($scope, $modalInstance, BookService, $stateParams, items) { //依賴于modalInstance     //items為傳過來的值     $scope.modalBack = function() {       //執(zhí)行模態(tài)框內(nèi)部操作     }      $scope.ok = function() {       $modalInstance.close($scope.textid); //關(guān)閉并返回當(dāng)前選項(xiàng)     };     $scope.cancel = function() {       $modalInstance.dismiss('cancel'); // 退出不執(zhí)行任何操作     }   }]) 

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持錯新站長站。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 武冈市| 临武县| 抚松县| 敦化市| 喀喇沁旗| 建昌县| 巍山| 施甸县| 临夏市| 泰兴市| 广州市| 蓬溪县| 璧山县| 定远县| 吕梁市| 康保县| 康马县| 蒲江县| 平定县| 克拉玛依市| 商水县| 五原县| 芦山县| 平安县| 南丰县| 宕昌县| 杨浦区| 浦北县| 新和县| 原平市| 长治市| 陇西县| 临泉县| 汉阴县| 桃源县| 和林格尔县| 开封市| 敦煌市| 航空| 象州县| 油尖旺区|