mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
Added action sheet thing back
This commit is contained in:
42
dist/js/ionic-angular.js
vendored
42
dist/js/ionic-angular.js
vendored
@ -416,26 +416,46 @@ angular.module('ionic.service.templateLoad', [])
|
|||||||
|
|
||||||
angular.module('ionic.ui.actionSheet', [])
|
angular.module('ionic.ui.actionSheet', [])
|
||||||
|
|
||||||
.directive('actionSheet', function() {
|
.directive('actionSheet', function($document) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: true,
|
scope: true,
|
||||||
replace: true,
|
replace: true,
|
||||||
link: function($scope, $element){
|
link: function($scope, $element){
|
||||||
|
var keyUp = function(e) {
|
||||||
|
if(e.which == 27) {
|
||||||
|
$scope.cancel();
|
||||||
|
$scope.$apply();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var backdropClick = function(e) {
|
||||||
|
if(e.target == $element[0]) {
|
||||||
|
$scope.cancel();
|
||||||
|
$scope.$apply();
|
||||||
|
}
|
||||||
|
};
|
||||||
$scope.$on('$destroy', function() {
|
$scope.$on('$destroy', function() {
|
||||||
$element.remove();
|
$element.remove();
|
||||||
|
$document.unbind('keyup', keyUp);
|
||||||
|
$element.unbind('click', backdropClick);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$document.bind('keyup', keyUp);
|
||||||
|
$element.bind('click', backdropClick);
|
||||||
},
|
},
|
||||||
template: '<div class="action-sheet slide-in-up">' +
|
template: '<div class="action-sheet-backdrop">' +
|
||||||
'<div class="action-sheet-group">' +
|
'<div class="action-sheet action-sheet-up">' +
|
||||||
'<div class="action-sheet-title" ng-if="titleText">{{titleText}}</div>' +
|
'<div class="action-sheet-group">' +
|
||||||
'<button class="button" ng-click="buttonClicked($index)" ng-repeat="button in buttons">{{button.text}}</button>' +
|
'<div class="action-sheet-title" ng-if="titleText">{{titleText}}</div>' +
|
||||||
'</div>' +
|
'<button class="button" ng-click="buttonClicked($index)" ng-repeat="button in buttons">{{button.text}}</button>' +
|
||||||
'<div class="action-sheet-group" ng-if="destructiveText">' +
|
'</div>' +
|
||||||
'<button class="button destructive" ng-click="destructiveButtonClicked()">{{destructiveText}}</button>' +
|
'<div class="action-sheet-group" ng-if="destructiveText">' +
|
||||||
'</div>' +
|
'<button class="button destructive" ng-click="destructiveButtonClicked()">{{destructiveText}}</button>' +
|
||||||
'<div class="action-sheet-group" ng-if="cancelText">' +
|
'</div>' +
|
||||||
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
'<div class="action-sheet-group" ng-if="cancelText">' +
|
||||||
|
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
||||||
|
'</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
};
|
};
|
||||||
|
|||||||
42
js/ext/angular/src/directive/ionicActionSheet.js
vendored
42
js/ext/angular/src/directive/ionicActionSheet.js
vendored
@ -3,26 +3,46 @@
|
|||||||
|
|
||||||
angular.module('ionic.ui.actionSheet', [])
|
angular.module('ionic.ui.actionSheet', [])
|
||||||
|
|
||||||
.directive('actionSheet', function() {
|
.directive('actionSheet', function($document) {
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
scope: true,
|
scope: true,
|
||||||
replace: true,
|
replace: true,
|
||||||
link: function($scope, $element){
|
link: function($scope, $element){
|
||||||
|
var keyUp = function(e) {
|
||||||
|
if(e.which == 27) {
|
||||||
|
$scope.cancel();
|
||||||
|
$scope.$apply();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var backdropClick = function(e) {
|
||||||
|
if(e.target == $element[0]) {
|
||||||
|
$scope.cancel();
|
||||||
|
$scope.$apply();
|
||||||
|
}
|
||||||
|
};
|
||||||
$scope.$on('$destroy', function() {
|
$scope.$on('$destroy', function() {
|
||||||
$element.remove();
|
$element.remove();
|
||||||
|
$document.unbind('keyup', keyUp);
|
||||||
|
$element.unbind('click', backdropClick);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$document.bind('keyup', keyUp);
|
||||||
|
$element.bind('click', backdropClick);
|
||||||
},
|
},
|
||||||
template: '<div class="action-sheet slide-in-up">' +
|
template: '<div class="action-sheet-backdrop">' +
|
||||||
'<div class="action-sheet-group">' +
|
'<div class="action-sheet action-sheet-up">' +
|
||||||
'<div class="action-sheet-title" ng-if="titleText">{{titleText}}</div>' +
|
'<div class="action-sheet-group">' +
|
||||||
'<button class="button" ng-click="buttonClicked($index)" ng-repeat="button in buttons">{{button.text}}</button>' +
|
'<div class="action-sheet-title" ng-if="titleText">{{titleText}}</div>' +
|
||||||
'</div>' +
|
'<button class="button" ng-click="buttonClicked($index)" ng-repeat="button in buttons">{{button.text}}</button>' +
|
||||||
'<div class="action-sheet-group" ng-if="destructiveText">' +
|
'</div>' +
|
||||||
'<button class="button destructive" ng-click="destructiveButtonClicked()">{{destructiveText}}</button>' +
|
'<div class="action-sheet-group" ng-if="destructiveText">' +
|
||||||
'</div>' +
|
'<button class="button destructive" ng-click="destructiveButtonClicked()">{{destructiveText}}</button>' +
|
||||||
'<div class="action-sheet-group" ng-if="cancelText">' +
|
'</div>' +
|
||||||
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
'<div class="action-sheet-group" ng-if="cancelText">' +
|
||||||
|
'<button class="button" ng-click="cancel()">{{cancelText}}</button>' +
|
||||||
|
'</div>' +
|
||||||
'</div>' +
|
'</div>' +
|
||||||
'</div>'
|
'</div>'
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user