Ionic menu (Actionsheet) instance code _javascript tips

Source: Internet
Author: User

The Pull menu (Actionsheet) lets the user select an option by using the box that pops up.

Very dangerous options will be highlighted in red to give people the first time to identify. You can make it disappear by clicking the Cancel button or by clicking on a blank space.

Instance

HTML Code

<body ng-app= "starter" ng-controller= "Actionsheetctl" >
<ion-pane>
<ion-content >

JavaScript Code

Triggers the pull up menu in your code, and you need to use $ionicActionSheet service in your angular controller:

Angular.module (' starter ', [' Ionic '])
. Run (function ($ionicPlatform) {
$ionicPlatform. Ready (function () {
//Hide the accessory bar by default (remove the accessory bar above the keyboard
//For form inputs )
if (Window.cordova && window.cordova.plugins.Keyboard) {
Cordova.plugins.Keyboard.hideKeyboardAccessoryBar (true);
if (window. StatusBar) {
statusbar.styledefault ();}})
. Controller (' Actionsheetctl ', [' $scope ', ' $ionicActionSheet ', ' $timeout ', function ($scope, $ionicActionSheet, $ Timeout {
$scope. Show = function () {
var hidesheet = $ionicActionSheet. Show {
buttons: [
{text: ' & Lt;b>share</b> This "},
{text: ' Move '}
],
destructivetext: ' Delete ',
titletext: ' Modify your album ',
canceltext: ' Cancel ',
cancel:function () {
//Add Cancel code ...
},
Buttonclicked:function (index) {return
true;
}
});
$timeout (function () {
hidesheet ();
}, \ n;
}; 
}])

The results of the operation are shown below:

Full Source:

 

The above is a small set up to introduce the Ionic menu (Actionsheet) example code related knowledge, I hope to help!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.