Kranthi Reddy
Kranthi Reddy

Reputation: 53

TS2322: Type 'string' is not assignable to type 'number'

<mat-carousel timings="200ms ease-in" [autoplay]="true" interval="3000">
  <mat-carousel-slide *ngFor="let slide of slides; let i = index" [image]="slide.image" 
            overlayColor="#ffffff" [hideOverlay]="false">
</mat-carousel-slide>

interval="3000" is throwing error 'string' is not assignable to type 'number'.

Upvotes: 5

Views: 7018

Answers (1)

Ga&#235;l J
Ga&#235;l J

Reputation: 15275

You have to use [interval]="3000".

Without the [..] you are not using Angular typed binding but just "regular" string-only binding. Or said differently, interval="3000" is the same as [interval]="'3000'".

Upvotes: 9

Related Questions