Search code examples
angularangular-materialwebstorm

Attribute matListItemTitle is not allowed here


Trying to implement a list from Angular Material in an Angular application. WebStorm arises the message written in the title above.

I found out the issue here but in this case I can't call matListItemTitle as a dynamic parameter (as described at the end of that post).

<h3>Two line lists</h3>
<mat-list>
  <mat-list-item>
    <span matListItemTitle>Title</span>
    <span matListItemLine>Second line</span>
  </mat-list-item>
  <mat-list-item>
    <span matListItemTitle>Title</span>
    <span>Second line</span>
  </mat-list-item>
  <mat-list-item>
    <span matListItemTitle>Title</span>
    Second line
  </mat-list-item>
</mat-list>

Solution

  • I recently had this same issue. In my case i was using an older version of angular (14.2.7). According to the angular Component documentation the matListItemTitle and matListItemLine attributes were introduced in angular 15

    Notes: Using Jetbrains Rider 2022.3.2