<ion-item-sliding> inside a custom component
Short description of the problem
The <ion-item-sliding> component does not work if it is used inside a custom component
What behavior are you expecting?
When using the <ion-item-sliding> component inside an <ion-list>, the item slides and the option buttons are revealed.
When I use the exact same code inside a custom component and I create an <ion-list> by repeating the custom component (which includes the <ion-item-sliding>) , the item does not slide.
Steps to reproduce:
- create an ionic project, version 2
- create a component with the following template:
<ion-item-sliding> <ion-item> <h2>Slimer</h2> </ion-item> <ion-item-options> <button secondary> <ion-icon name="call"></ion-icon> Call </button> </ion-item-options> </ion-item-sliding> - on a page, create a list that includes the component you created on step 2
- run ionic serve and try to slide the item
Which Ionic Version? 2.0.0-beta.23
Run ionic info from terminal/cmd prompt:
Cordova CLI: 5.4.1
Gulp version: CLI version 3.9.0
Gulp local: Local version 3.9.1
Ionic Version: 2.0.0-beta.3
Ionic CLI Version: 2.0.0-beta.23
Ionic App Lib Version: 2.0.0-beta.13
OS:
Node Version: v4.2.4
Hello! Thanks for opening an issue with us! So when you say custom component do you mean your creating a custom angular2 component (using this decorator @Component) or are you creating an ionic page component (using @Page)?
Hello!
I am creating a custom angular2 component , with the decorator @Component
Thanks!
@jalef You need to import IONIC_DIREVTIVES for any custom component that uses an Ionic component.
import {IONIC_DIREVTIVES} from 'ionic-angular';
...
@Component({
template: ....,
directives: [IONIC_DIREVTIVES]
})
http://ionicframework.com/docs/v2/faq/#Angular_component
thanks!