Ionic Slider option not working

I am trying to implement slides from here

I am trying disable the centered slides I am using following code:

<ion-slides [centeredSlides]="false">

But slides are still coming centered. Any idea what am I missing?

You are trying to disable centered slides and the slides arent coming centered ?
This makes no sense, can you please describe again what you are trying todo?

I might be able to help you out :slight_smile:

I have made an edit to original post in the last line to make it clearly understandable. By default slides are centered. But I don’t want them as centered. So i added an option from documentation but it does not seem to be working.

Alright I see, it should work already.
You might have forgotten to place your text/image into the right place with CSS.


If this method above doesn’t work, then you can try this:

Remove [centeredSlides]=“false” from your HTML. Do this with your .ts file

TS:

import { Slides } from 'ionic-angular';
import { ViewChild } from '@angular/core';

//Above constructor
@ViewChild(Slides) slides: Slides;

//Add the method
ionViewWillEnter() {
 this.slides.centeredSlides(false);
}

This should work. :grin:

okay so I tried above one and I face this error:

this.slides.centeredSlides(false);

[ts] Cannot invoke an expression whose type lacks a call signature. Type ‘Boolean’ has no compatible call signatures.

Ops sorry then I forgot that the centeredSlides is not an Instance Member instead its an Input Property.

This code should work.

this.slides.centeredSlides = false;

Else if this also doesn’t work try adding this into your constructor:

private _centeredSlides: boolean = false

Here is a complete demo of what is possible with Input Properties