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

Viewed 2901
<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'.

1 Answers

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'".

Related