I wanted to render three cards with given contents in array using string interpollation. As well as set the style property of the specific card according to the given string in the array.
But I am having issue setting style property to my card. Issue is whenever I try to set style using string interpolation my view just displays blank.
<div class="row-sm-2" *ngFor="let post of classifications">
<mat-card style={{ post.margin }}>
<p style="color: #62697D;">{{ post.content }}</p>
</mat-card>
</div>
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
classifications = [
{margin: '0px; width: 100%', content: 'Hello there'},
{margin: '20px; width: 100%', content: 'Hi there'},
{margin: '20px; width: 100%', content: 'Well its angular'}
];
}
<mat-card style="{{ post.margin }}">Also check the console.