I'm trying to display data passed to a dialog component using *ngFor. I'm passing data like this
const columnNames=['firstName', 'lastName','userName'];
this.dialog.open(DatatableAdvancedSearchComponent,{
width: '250px',
data: {columnNames:columnNames}
});
and I'm trying to access them in the dialog component using 1.view page
<div class="row">
<select class="form-control">
<option *ngFor="let column in columns" value="{{column}}">{{column}}</option>
</select>
{{data.columnNames}}
{{columns}}
</div>
2.ts page
columns=[];
constructor(@Inject(MAT_DIALOG_DATA) public data: any) {
this.columns=this.data.columnNames;
}
I get the output for
{{data.columnNames}}
{{columns}}
but not for the select statement. select is not filling with options. the same columns get populated below as you can see, but why not in the select statement. any suggestions please.