中文字幕一区二区人妻电影,亚洲av无码一区二区乱子伦as ,亚洲精品无码永久在线观看,亚洲成aⅴ人片久青草影院按摩,亚洲黑人巨大videos

ionic 浮動框


$ionicPopover

$ionicPopover 是一個可以浮在app內(nèi)容上的一個視圖框。

可以實(shí)現(xiàn)以下功能點(diǎn):

  • 在當(dāng)前頁面顯示更多信息。
  • 選擇一些工具或配置。
  • 在頁面提供一個操作列表。

方法

fromTemplate(templateString, options)
或
fromTemplateUrl(templateUrl, options)

參數(shù)說明:

templateString: 模板字符串。

templateUrl: 載入的模板 URL。

options: 初始化選項。

實(shí)例

HTML 代碼部分

<p> <button ng-click="openPopover($event)">打開浮動框</button> </p> <script id="my-popover.html" type="text/ng-template"> <ion-popover-view> <ion-header-bar> <h1 class="title">我的浮動框標(biāo)題</h1> </ion-header-bar> <ion-content> Hello! </ion-content> </ion-popover-view> </script>

fromTemplateUrl 方法

angular.module('ionicApp', ['ionic']) .controller( 'AppCtrl',['$scope','$ionicPopover','$timeout',function($scope,$ionicPopover,$timeout){ $scope.popover = $ionicPopover.fromTemplateUrl('my-popover.html', { scope: $scope }); // .fromTemplateUrl() 方法 $ionicPopover.fromTemplateUrl('my-popover.html', { scope: $scope }).then(function(popover) { $scope.popover = popover; }); $scope.openPopover = function($event) { $scope.popover.show($event); }; $scope.closePopover = function() { $scope.popover.hide(); }; // 清除浮動框 $scope.$on('$destroy', function() { $scope.popover.remove(); }); // 在隱藏浮動框后執(zhí)行 $scope.$on('popover.hidden', function() { // 執(zhí)行代碼 }); // 移除浮動框后執(zhí)行 $scope.$on('popover.removed', function() { // 執(zhí)行代碼 }); }])

運(yùn)行代碼 ?

我們也可以把模板當(dāng)作一個字符串,使用 .fromTemplate() 方法來實(shí)現(xiàn)彈框:

fromTemplate 方法

angular.module('ionicApp', ['ionic']) .controller( 'AppCtrl',['$scope','$ionicPopover','$timeout',function($scope,$ionicPopover,$timeout){ $scope.popover = $ionicPopover.fromTemplateUrl('my-popover.html', { scope: $scope }); // .fromTemplate() 方法 var template = '<ion-popover-view><ion-header-bar> <h1 class="title">我的浮動框標(biāo)題</h1> </ion-header-bar> <ion-content> Hello! </ion-content></ion-popover-view>'; $scope.popover = $ionicPopover.fromTemplate(template, { scope: $scope }); $scope.openPopover = function($event) { $scope.popover.show($event); }; $scope.closePopover = function() { $scope.popover.hide(); }; // 清除浮動框 $scope.$on('$destroy', function() { $scope.popover.remove(); }); // 在隱藏浮動框后執(zhí)行 $scope.$on('popover.hidden', function() { // 執(zhí)行代碼 }); // 移除浮動框后執(zhí)行 $scope.$on('popover.removed', function() { // 執(zhí)行代碼 }); }])

運(yùn)行代碼 ?