Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
The fix @ajoslin provided doesn't work. All what's being extended in his fix is later overloaded 20 lines below (scope.destructiveButtonClicked, scope.buttonClicked and scope.cancel). Furthermore, the error doesn't come from calling scope.cancel() but from calling opts.cancel(). I've eliminated the redundant code and also fixed the original bug.
  • Loading branch information
hallucynogenyc committed Jun 5, 2014
1 parent 53af788 commit 163cd0c
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions js/angular/service/actionSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,8 @@ function($rootScope, $document, $compile, $animate, $timeout, $ionicTemplateLoad
*/
show: function(opts) {
var scope = $rootScope.$new(true);

extend(scope, {
cancel: angular.noop,
buttonClicked: angular.noop,
destructiveButtonClicked: angular.noop,
buttons: []
}, opts);

scope.buttons = opts.buttons ? opts.buttons : [];

// Compile the template
var element = $compile('<ion-action-sheet buttons="buttons"></ion-action-sheet>')(scope);
Expand All @@ -94,7 +89,7 @@ function($rootScope, $document, $compile, $animate, $timeout, $ionicTemplateLoad
sheetEl.removeClass('action-sheet-up');
if(didCancel) {
$timeout(function(){
opts.cancel();
scope.cancel();
}, 200);
}

Expand Down

0 comments on commit 163cd0c

Please sign in to comment.