mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
docs($ionicActionSheet): write docs
This commit is contained in:
@@ -3,6 +3,10 @@
|
||||
|
||||
angular.module('ionic.ui.actionSheet', [])
|
||||
|
||||
/*
|
||||
* We don't document the ionActionSheet directive, we instead document
|
||||
* the $ionicActionSheet service
|
||||
*/
|
||||
.directive('ionActionSheet', ['$document', function($document) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
|
||||
63
js/ext/angular/src/service/ionicActionSheet.js
vendored
63
js/ext/angular/src/service/ionicActionSheet.js
vendored
@@ -1,16 +1,73 @@
|
||||
angular.module('ionic.service.actionSheet', ['ionic.service.templateLoad', 'ionic.service.platform', 'ionic.ui.actionSheet', 'ngAnimate'])
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name $ionicActionSheet
|
||||
* @module ionic
|
||||
* @restrict E
|
||||
* @description
|
||||
* The Action Sheet is a slide-up pane that lets the user choose from a set of options.
|
||||
* Dangerous options are highlighted in red and made obvious.
|
||||
*
|
||||
* There are easy ways to cancel out of the action sheet, such as tapping the backdrop or even
|
||||
* hitting escape on the keyboard for desktop testing.
|
||||
*
|
||||
* 
|
||||
*
|
||||
* @usage
|
||||
* To trigger an Action Sheet in your code, use the $ionicActionSheet service in your angular controllers:
|
||||
*
|
||||
* ```js
|
||||
* angular.module('mySuperApp', ['ionic'])
|
||||
* .controller(function($scope, $ionicActionSheet) {
|
||||
*
|
||||
* // Triggered on a button click, or some other target
|
||||
* $scope.show = function() {
|
||||
*
|
||||
* // Show the action sheet
|
||||
* $ionicActionSheet.show({
|
||||
* buttons: [
|
||||
* { text: 'Share' },
|
||||
* { text: 'Move' },
|
||||
* ],
|
||||
* destructiveText: 'Delete',
|
||||
* titleText: 'Modify your album',
|
||||
* cancelText: 'Cancel',
|
||||
* buttonClicked: function(index) {
|
||||
* return true;
|
||||
* }
|
||||
* });
|
||||
*
|
||||
* };
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
*/
|
||||
.factory('$ionicActionSheet', ['$rootScope', '$document', '$compile', '$animate', '$timeout', '$ionicTemplateLoader', '$ionicPlatform',
|
||||
function($rootScope, $document, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicPlatform) {
|
||||
function($rootScope, $document, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicPlatform) {
|
||||
|
||||
return {
|
||||
/**
|
||||
* Load an action sheet with the given template string.
|
||||
* @ngdoc method
|
||||
* @name $ionicActionSheet#show
|
||||
* @description
|
||||
* Load and return a new action sheet.
|
||||
*
|
||||
* A new isolated scope will be created for the
|
||||
* action sheet and the new element will be appended into the body.
|
||||
*
|
||||
* @param {object} opts the options for this ActionSheet (see docs)
|
||||
* @param {object} opts The options for this ActionSheet. Properties:
|
||||
*
|
||||
* - `[Object]` `buttons` Which buttons to show. Each button is an object with a `text` field.
|
||||
* - `{string}` `titleText` The title to show on the action sheet.
|
||||
* - `{string=}` `cancelText` The text for a 'cancel' button on the action sheet.
|
||||
* - `{string=}` `destructiveText` The text for a 'danger' on the action sheet.
|
||||
* - `{function=}` `cancel` Called if the cancel button is pressed or the backdrop is tapped.
|
||||
* - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,
|
||||
* with the index of the button that was clicked. Return true to close the action sheet,
|
||||
* or false to keep it opened.
|
||||
* - `{function=}` `destructiveButtonClicked` Called when the destructive button is clicked.
|
||||
* Return true to close the action sheet, or false to keep it opened.
|
||||
*/
|
||||
show: function(opts) {
|
||||
var scope = $rootScope.$new(true);
|
||||
|
||||
Reference in New Issue
Block a user