[Ionic V4.0.0-beta.7] [ion-item-sliding] Sliding not working after empty an element in array
See original GitHub issueBug Report
Ionic Info
Run ionic info
from a terminal/cmd prompt and paste the output below.
Ionic:
ionic (Ionic CLI) : 4.1.2 (C:\Users\fkrishna\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0-beta.7
@angular-devkit/core : 0.7.5
@angular-devkit/schematics : 0.7.5
@angular/cli : 6.1.5
@ionic/ng-toolkit : 1.0.8
@ionic/schematics-angular : 1.0.6
System:
NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 5.6.0
OS : Windows 10
Describe the Bug I created an array of 3 elements and i used the <ngFor> and the <ion-item-sliding">directive to show a list of sliding item. Each item has a remove button to remove the target element, but after removing one element the sliding stop working for the remaining items
Steps to Reproduce Steps to reproduce the behavior:
- Go to ‘…’
- Click on ‘…’
- Scroll down to ‘…’
- See error
Related Code
<ion-content>
<ion-list>
<ion-item-sliding *ngFor="let n of numbers; index as i">
<ion-item>
{{ n }}
</ion-item>
<ion-item-options>
<ion-item-option " (click)="remove(i)">Delete</ion-item-option>
</ion-item-options>
</ion-item-sliding>
</ion-list>
numbers = ['1','2','3'];
constructor() {}
remove(i) {
this.numbers.splice(i, 1);
}
Expected Behavior the sliding is suppose to work correctly for each items even after removing an element
Additional Context List any other information that is relevant to your issue. Stack traces, related issues, suggestions on how to fix, Stack Overflow links, forum links, screenshots, OS if applicable, etc.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:30 (5 by maintainers)
Top Results From Across the Web
[Ionic V4.0.0-beta.7] [ion-item-sliding] Sliding not ... - GitHub
[Ionic V4.0.0-beta.7] [ion-item-sliding] Sliding not working after empty an element in array #15486.
Read more >[Ionic V4.0.0-beta.7] [ion-item-sliding] Sliding not working after empty ...
[Ionic V4.0.0-beta.7] [ion-item-sliding] Sliding not working after empty an element in array.
Read more >Ion-item-sliding not working on phone (ionic v4)
Using version 4.0.0-beta.7, once deployed in Android or iOS, the sliding works fine initially, but after a while it is not possible to...
Read more >Is there a way to find out if the "ion-item-sliding" is back in idle ...
As soon as I release the item and it goes back into the idle position, which should be 0, the (ionDrag) stops emitting...
Read more >Vertical Scroll In Storybook Is Not Accurate - ADocLib
Storybook CodeSandbox Not specifying a vertical or horizontal alignment will ... [Ionic V4.0.0beta.7] [ionitemsliding] Sliding not working after empty an.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also had the same issue, with a dynamic list of elements, deleting an item with the <ion-item-sliding> component, then refreshing the elements cause it not to be able to delete any other elements until a refresh.
After digging around i noticed that without the refresh of elements it worked fine, looking at the docs there is a method to close all sliding items on the item or on the list. using this fixed the issue.
#dynamicList
@ViewChild('dynamicList') dynamicList;
<ion-item-option>
triggering thedynamicList.closeSlidingItems()
before deleting the record.Hope this helps in the meantime, i am new to angular so hopefully i am not doing anything that stupid.
not all heroes wear capes, thx @jcollings for the solution!
html:
ts: