I am trying to display a basic data table but cannot seem to get it working even though I've read through the documentation. I am not getting any console errors, the table just does not display. I am able to get some of the other prime ng components to work so I assume there is nothing wrong with my setup.
I have an array declared in my component that looks like this:
this.employees = [
{"firstName":"John", "lastName":"Doe"},
{"firstName":"Anna", "lastName":"Smith"},
{"firstName":"Peter","lastName":"Jones"}
];
In my template I have this:
<p-dataTable [value]="employees">
<p-column field="firstName" header="First Name"></p-column>
<p-column field="lastName" header="Last Name"></p-column>
</p-dataTable>
Perhaps I have misunderstood the documentation and there is something wrong with either my array or my template? Thanks
I figured out what the problem was. I just forgot to add the DataTable and Column directives to the component. It works fine after including them
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With