没有合适的资源?快使用搜索试试~ 我知道了~
Ionic AngularJS API
需积分: 10 17 下载量 126 浏览量
2015-10-01
10:31:17
上传
评论 1
收藏 633KB PDF 举报
温馨提示
试读
63页
Ionic AngularJS API的文档, 综合和原英文网站和中文网站的API说明。
资源推荐
资源详情
资源评论
AngularJS Extensions
AngularJS Extensions
http://www.ionicframework.com/docs/api/
Action Sheet
Backdrop
Content
Form Inputs
Gestures and Events
Headers/Footers
Keyboard
Lists
Loading
Modal
Navigation
Platform
Popover
Popup
Scroll
Side Menus
Slide Box
Spinner
Tabs
Tap & Click
Utility
AngularJS Extensions
Ionic is both a CSS framework and a Javascript UI library. Many components need Javascript in order to produce magic, though
often components can easily be used without coding through framework extensions such as our AngularIonic extensions.
Ionic follows the View Controller pattern popularized in such frameworks as Cocoa Touch. In the View Controller pattern, we treat
different sections of the interface as child Views or even child View Controllers that contain other views. View Controllers then
"power" the Views inside of them to provide interaction and UI functionality. A great example is the Tab Bar View Controller which
processes taps on a Tab Bar to switch between a set of viewable panes.
Explore our API docs for detailed information on the View Controllers and Javascript utilities available in Ionic.
$ionicActionSheet
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:
angular.module('mySuperApp', ['ionic'])
.controller(function($scope, $ionicActionSheet, $timeout) {
// Triggered on a button click, or some other target
$scope.show = function() {
// Show the action sheet
var hideSheet = $ionicActionSheet.show({
buttons: [
{ text: '<b>Share</b> This' },
{ text: 'Move' }
],
destructiveText: 'Delete',
titleText: 'Modify your album',
cancelText: 'Cancel',
cancel: function() {
// add cancel code..
},
buttonClicked: function(index) {
return true;
}
});
// For example's sake, hide the sheet after two seconds
$timeout(function() {
hideSheet();
}, 2000);
};
});
Methods
show(options)
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.
Pa
ra
m
Ty
pe
Details
op
tio
ns
ob
je
ct
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, the backdrop is tapped or the hardware back button is pressed.
{function=} buttonClicked Called when one of the non-destructive buttons is clicked, with the index of the button that was clic
ked and the button object. 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.
{boolean=} cancelOnStateChange Whether to cancel the actionSheet when navigating to a new state. Default true.
{string} cssClass The custom CSS class name.
Returns: function hideSheet A function which, when called, hides & cancels the action sheet.
/**
* @ngdoc service
* @name $ionicActionSheet
* @module ionic
* @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.
*
* ![Action Sheet](http://ionicframework.com.s3.amazonaws.com/docs/controllers/actionSheet.gif)
*
* @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, $timeout) {
*
* // Triggered on a button click, or some other target
* $scope.show = function() {
*
* // Show the action sheet
* var hideSheet = $ionicActionSheet.show({
* buttons: [
* { text: '<b>Share</b> This' },
* { text: 'Move' }
* ],
* destructiveText: 'Delete',
* titleText: 'Modify your album',
* cancelText: 'Cancel',
* cancel: function() {
// add cancel code..
},
* buttonClicked: function(index) {
* return true;
* }
* });
*
* // For example's sake, hide the sheet after two seconds
* $timeout(function() {
* hideSheet();
* }, 2000);
*
* };
* });
* ```
*
*/
IonicModule
.factory('$ionicActionSheet', [
'$rootScope',
'$compile',
'$animate',
'$timeout',
'$ionicTemplateLoader',
'$ionicPlatform',
'$ionicBody',
'IONIC_BACK_PRIORITY',
function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicPlatform, $ionicBody, IONIC_
BACK_PRIORITY) {
return {
show: actionSheet
};
/**
* @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} options 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, the backdrop is tapped or
* the hardware back button is pressed.
* - `{function=}` `buttonClicked` Called when one of the non-destructive buttons is clicked,
* with the index of the button that was clicked and the button object. 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.
* - `{boolean=}` `cancelOnStateChange` Whether to cancel the actionSheet when navigating
* to a new state. Default true.
* - `{string}` `cssClass` The custom CSS class name.
*
* @returns {function} `hideSheet` A function which, when called, hides & cancels the action sheet.
*/
function actionSheet(opts) {
var scope = $rootScope.$new(true);
extend(scope, {
cancel: noop,
destructiveButtonClicked: noop,
buttonClicked: noop,
$deregisterBackButton: noop,
buttons: [],
cancelOnStateChange: true
}, opts || {});
function textForIcon(text) {
if (text && /icon/.test(text)) {
scope.$actionSheetHasIcon = true;
}
}
for (var x = 0; x < scope.buttons.length; x++) {
textForIcon(scope.buttons[x].text);
}
textForIcon(scope.cancelText);
textForIcon(scope.destructiveText);
// Compile the template
var element = scope.element = $compile('<ion-action-sheet ng-class="cssClass" buttons="buttons"></ion-actio
n-sheet>')(scope);
// Grab the sheet element for animation
var sheetEl = jqLite(element[0].querySelector('.action-sheet-wrapper'));
var stateChangeListenDone = scope.cancelOnStateChange ?
$rootScope.$on('$stateChangeSuccess', function() { scope.cancel(); }) :
noop;
// removes the actionSheet from the screen
scope.removeSheet = function(done) {
if (scope.removed) return;
scope.removed = true;
sheetEl.removeClass('action-sheet-up');
$timeout(function() {
// wait to remove this due to a 300ms delay native
// click which would trigging whatever was underneath this
$ionicBody.removeClass('action-sheet-open');
}, 400);
scope.$deregisterBackButton();
stateChangeListenDone();
$animate.removeClass(element, 'active').then(function() {
scope.$destroy();
element.remove();
// scope.cancel.$scope is defined near the bottom
剩余62页未读,继续阅读
资源评论
m99m11
- 粉丝: 0
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- juhua-p8YYy-v0e13a7b5(1).apk
- Neo4j资源:Neo4j.rb的性能测试相关程序
- 排序算法之堆排序算法:用C++语言实现堆排序算法
- 基于Springboot的房屋租赁系统(源代码+论文+说明文档+PPT)-计算机专业精品毕业设计和课程设计
- leidian.py
- 直接插入排序算法:C语言实现直接插入排序算法
- 基于Springboot的大学生就业招聘系统(源代码+论文+说明文档+PPT)-计算机专业精品毕业设计和课程设计
- 基于Vue的H5结婚请帖前端设计源码
- saxaxasxasx
- 基于SSM++jsp的实验室耗材管理系统(源代码+论文+说明文档+PPT)-计算机专业精品毕业设计和课程设计
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功