I'm trying to learn Angular so following guides on installing and using ag-grid and Font Awesome, but I can't get an fa-icon to display inside an ag-grid cell using the cellRenderer. If I use the same icon HTML outside of the grid, it displays correctly. And if I put something like a link in place of the icon in the cell, it displays correctly. Here is my code:
component.ts
import { Component } from '@angular/core'
import { faUserEdit } from '@fortawesome/free-solid-svg-icons';
@Component({
selector: 'app-user',
templateUrl: './user.component.html',
styleUrls: ['./user.component.scss']
})
export class UserComponent {
faUserEdit = faUserEdit;
columnDefs = [
{
headerName: '', field: 'id',
cellRenderer: (params) =>
'<fa-icon [icon]="faUserEdit"></fa-icon>'
},
{ headerName: 'Last Name', field: 'lastName'},
{ headerName: 'First Name', field: 'firstName'}
]
...
component.html
<ag-grid-angular class="ag-theme-material"
[rowData]="users"
[columnDefs]="columnDefs">
</ag-grid-angular>