I want my page to display 2 tabs, each will contain a table. Since structural of tables are the same, i created a custom component for a table, and used it as a child component. Parent page:
<p-tabPanel>
<cutomComp #table1 [items]=>"variable1"</customComp>
</<p-tabPanel>
<p-tabPanel>
<cutomComp #table2 [items]="variable2"></customComp>
</<p-tabPanel>
My custom component:
<p-dataTable [value]="itemsForTable">
</p-dataTable>
ngOnChanges(changes: SimpleChanges){
//init itemsForTable from items
}
The problem is that the table is been updated (ngOnChanges is called) only when variable1 is changed, and not when variable2 is changed. Why? Also, when ngOnChanges is executed for variable1 than table2 been updated too. So what is the problem? i want each table to be independent, how can i achieve that?
Thanks in advance.
[items]=>"variable1"
is a likely culprit if it's like that in your actual code – Z. Bagley Oct 21 '17 at 14:23