mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 15:51:16 +08:00
Lots of action sheet work
This commit is contained in:
31
js/ext/angular/src/directive/ionicActionSheet.js
vendored
31
js/ext/angular/src/directive/ionicActionSheet.js
vendored
@ -3,7 +3,7 @@
|
||||
|
||||
angular.module('ionic.ui.actionSheet', [])
|
||||
|
||||
.directive('actionSheet', function() {
|
||||
.directive('actionSheet', function($document) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: true,
|
||||
@ -12,17 +12,26 @@ angular.module('ionic.ui.actionSheet', [])
|
||||
$scope.$on('$destroy', function() {
|
||||
$element.remove();
|
||||
});
|
||||
|
||||
$document.bind('keyup', function(e) {
|
||||
if(e.which == 27) {
|
||||
$scope.cancel();
|
||||
$scope.$apply();
|
||||
}
|
||||
});
|
||||
},
|
||||
template: '<div class="action-sheet slide-in-up">' +
|
||||
'<div class="action-sheet-group">' +
|
||||
'<div class="action-sheet-title" ng-if="titleText">{{titleText}}</div>' +
|
||||
'<button class="button" ng-click="buttonClicked($index)" ng-repeat="button in buttons">{{button.text}}</button>' +
|
||||
'</div>' +
|
||||
'<div class="action-sheet-group" ng-if="destructiveText">' +
|
||||
'<button class="button destructive" ng-click="destructiveButtonClicked()">{{destructiveText}}</button>' +
|
||||
'</div>' +
|
||||
'<div class="action-sheet-group" ng-if="cancelText">' +
|
||||
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
||||
template: '<div class="action-sheet-backdrop">' +
|
||||
'<div class="action-sheet slide-in-up">' +
|
||||
'<div class="action-sheet-group">' +
|
||||
'<div class="action-sheet-title" ng-if="titleText">{{titleText}}</div>' +
|
||||
'<button class="button" ng-click="buttonClicked($index)" ng-repeat="button in buttons">{{button.text}}</button>' +
|
||||
'</div>' +
|
||||
'<div class="action-sheet-group" ng-if="destructiveText">' +
|
||||
'<button class="button destructive" ng-click="destructiveButtonClicked()">{{destructiveText}}</button>' +
|
||||
'</div>' +
|
||||
'<div class="action-sheet-group" ng-if="cancelText">' +
|
||||
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>'
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user