Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ion-delete-button icon not showing #1181

Closed
christyharagan opened this issue Apr 21, 2014 · 4 comments
Closed

ion-delete-button icon not showing #1181

christyharagan opened this issue Apr 21, 2014 · 4 comments

Comments

@christyharagan
Copy link

I am using the ion-delete-button for, admittedly, the exact opposite use: to add items to a list (actually, it's a rather more complex use-case but that's the crux of the issue).

When the button is clicked and in the callback a new item added, the resulting row shows a blank icon for the delete button.

Looking at the html for this new row's delete button, it appears (in Chrome) that the ::before and ::after pseudo elements are missing.

The work-around is to (in a different "turn" - e.g. a setTimeout) hide then re-show the delete buttons.

I am using the nightly build of the code.

The following html snippet shows the bug: Click on the delete button for A or B, and a new row C is added, but with a blank delete button:

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <link href="styles/ionic.css" rel="stylesheet">
    <script src="scripts/ionic.bundle.js"></script>
</head>
<body ng-app="test" ng-controller="ctrl">
<ion-content>
      <ion-list show-delete="true">
      <ion-item ng-repeat="item in items" item="item">
      {{item.text}}
      <ion-delete-button class="ion-minus-circled" ng-click="addItem()"></ion-delete-button>
      </ion-item>
      </ion-list>
</ion-content>
</body>
<script>
angular.module('test', ['ionic']).controller('ctrl', function($scope) {
$scope.items = [{
    text: 'A'
},{
    text: 'B'
}];

$scope.addItem = function() {
    $scope.items.push({
        text: 'C'
    });
};
});
</script>
</html>
@christyharagan
Copy link
Author

To demonstrate the workaround, the callback becomes:

$scope.addItem = function() {
    $scope.items.push({
        text: 'C'
    });
    $ionicListDelegate.showDelete(false);
    setTimeout(function(){
        $ionicListDelegate.showDelete(true);
        $scope.$apply();
    }, 0);
};

@christyharagan
Copy link
Author

Just for clarity:

  • It would be nice if this workaround wasn't necessary: i.e., adding an item from a delete-button callback displayed the new delete-button correctly.
  • This behaviour only occurs (as far as I can tell) when the item is added from the delete-button callback. Adding an item from any other part of the code displays the delete-button icon correctly.

@ajoslin
Copy link
Contributor

ajoslin commented Apr 21, 2014

Thanks @christyharagan for the super detailed report! Should be working in nightly within 20 minutes from this post, when the CDN is updated.

The problem was that if a new item was created, its delete button wouldn't be shown until the list re-showed all the delete buttons again.

Now an item shows its delete button on creation if the parent list is already showing delete buttons.

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 6, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants