Skip to content

Commit

Permalink
fix(slidebox): removing an item breaks slidebox
Browse files Browse the repository at this point in the history
By default, because Ionic is using ngAnimate, when you use ngRepeat, angular will not destroy the DOM of the element straight away, but it will first add the css class: ng-leave to give the user a chance to set animation when deleting an item from the array.

This commit disables $animate for the slideBox element.
  • Loading branch information
labrute974 committed May 27, 2015
1 parent 6c9bc15 commit f3a8537
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/angular/directive/slideBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,13 @@
*/
IonicModule
.directive('ionSlideBox', [
'$animate',
'$timeout',
'$compile',
'$ionicSlideBoxDelegate',
'$ionicHistory',
'$ionicScrollDelegate',
function($timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $ionicScrollDelegate) {
function($animate, $timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $ionicScrollDelegate) {
return {
restrict: 'E',
replace: true,
Expand Down Expand Up @@ -153,6 +154,9 @@ function($timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory, $ionicScroll
'</div>',

link: function($scope, $element, $attr) {
// Disable ngAnimate for slidebox and its children
$animate.enabled(false, $element);

// if showPager is undefined, show the pager
if (!isDefined($attr.showPager)) {
$scope.showPager = true;
Expand Down

0 comments on commit f3a8537

Please sign in to comment.