简体   繁体   中英

Can't use mat-grid-list ERROR DOMException: Failed to execute 'setAttribute' on 'Element': ',' is not a valid attribute name

<mat-grid-list cols="3", rowHeight="4:3" >
  <mat-grid-tile *ngFor="let itemCard of itemCards">
 
<!--<ul>-->
<!--  <li *ngFor="let itemCard of itemCards">-->
<mat-card class="card">
  <mat-card-header>
    <div mat-card-avatar class=""></div>
    <mat-card-title>
      {{itemCard.brand}}
    </mat-card-title>
    <img mat-card-avatar src="https://material.angular.io/assets/img/examples/shiba2.jpg" alt="Photo of a Shiba Inu">
    <mat-card-subtitle>
      {{itemCard.model}}
    </mat-card-subtitle>
  </mat-card-header>
  <img mat-card-image src="" alt="Photo of a Shiba Inu">
  <mat-card-content>
    <p>
      {{itemCards}}
      {{itemCard.descriere}}

    </p>
    <div>Price {{itemCard.price}}</div>
    <div>Size {{itemCard.size}}</div>

  </mat-card-content>
  <mat-card-actions>
    <button mat-button>Add to Cart</button>
<!--    <button mat-button>Favorites</button>-->
  </mat-card-actions>
</mat-card>

<!--  </li>-->
<!--</ul>-->
  </mat-grid-tile>
</mat-grid-list>

Hello, I create a mat-card template and I'm trying to display data from backend into a mat-grid-list with cards as you can see in the code from above and i get this Error: "main.ts:11 ERROR DOMException: Failed to execute 'setAttribute' on 'Element': ',' is not a valid attribute name." I dont'know how to repair this please help me. I mention that i try the exact same thing but i use

  • as you can see commented in the code and it worked but with grid list don't.

  • there is comma in between the attributes

    <mat-grid-list cols="3", rowHeight="4:3" >
    
    // should be
    
    <mat-grid-list cols="3" rowHeight="4:3" >
    

    The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

     
    粤ICP备18138465号  © 2020-2024 STACKOOM.COM