最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2017年05月27日 10:25:11   作者:Drongguang  
本篇文章主要介紹了angularJS模態(tài)框$modal實(shí)例代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧

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: '一個(gè)作用域?yàn)槟B(tài)的內(nèi)容使用($modal會(huì)創(chuàng)建一個(gè)當(dāng)前作用域的子作用域,scope可有可無(wú))默認(rèn)為$rootScope', 
    resolve: { 
      items: function() { 
        return $scope.id; //向模態(tài)框控制器中傳值 
      } 
    } 
    background: '', //控制背景,true(有) or false(無(wú)),static背景存在,但是點(diǎn)擊模態(tài)窗口之外,模態(tài)窗不關(guān)閉 
    keyboard: '', //按下Esc時(shí),模態(tài)對(duì)話(huà)框是否關(guān)閉,默認(rèn)為ture 
    windowClass: '' //指定一個(gè)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) { //依賴(lài)于modalInstance 
    //items為傳過(guò)來(lái)的值 
    $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í)行任何操作 
    } 
  }]) 

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

确山县| 班戈县| 瓮安县| 彰武县| 桓台县| 小金县| 望谟县| 长治市| 利川市| 翁牛特旗| 金堂县| 建昌县| 元阳县| 青川县| 金门县| 谷城县| 呼伦贝尔市| 旬邑县| 保康县| 达孜县| 四会市| 舞阳县| 舞钢市| 洞头县| 嘉善县| 闽清县| 信宜市| 徐水县| 醴陵市| 司法| 齐齐哈尔市| 陆丰市| 平凉市| 蚌埠市| 北辰区| 青海省| 渭源县| 水城县| 东乌| 大宁县| 鹤壁市|