I need assistance with filtering the value of PLAN
https://i.sstatic.net/QZEqu.png
When I input a value like 1
https://i.sstatic.net/N1SCz.png
The filter works correctly...
However, if I input the value 4
, I encounter an issue...
https://i.sstatic.net/54WNB.png
I also retrieve information for place 8
.
I'm having trouble understanding what's causing this problem?
Thank you in advance for helping me solve this issue.
todo.service.ts file
PLN_PLC = [
{
PLACECODE: 26,
PLACELABEL: "Fundsettle",
PLN_SVM: [
{
SVM: 16111801,
ISIN: "LU0100749679",
LABEL: "NEKR FD LIFESTYLE DYNAMICC",
PLN: [
{
CODE: "NEKR01",
PLAN: 8,
CANAL: "*",
AV: "A",
LIB: "Fonds NEKRenta 8",
DATEV_EFFECTIVE: "0001-01-01",
PLAGE: [
{
BORNE: 9999999999999.99,
FRAIS_BORDEREAU: 0.00,
FRAIS_RETRAIT: 0.00,
TYPE_COURTAGE: 1,
COURTAGE: 0.00,
MIN_COURTAGE: 0.00,
TYPE_FRAIS_ETR: 1,
FRAIS_ETRANGERS: 2.00,
MIN_FRAIS_ETR: 0.00
},
// Other data...
]
},
// Other data...
]
},
// Other data...
]
},
// Additional data...
];
// Code continues...
todo.component.ts
// TypeScript code for filtering by plan
export class TodoComponent implements OnInit {
tarificationTitre: PlnPlcInfo[] = [];
planFilter: string = '';
constructor(private todoService: TodoService) { }
ngOnInit() {
this.tarificationTitre = this.todoService.PLN_PLC;
}
filterByPlan() {
this.tarificationTitre = this.todoService.PLN_PLC.filter(item => {
return item.PLN_SVM.some(svm => svm.PLN.some(plan => plan.PLAN.toString() === this.planFilter));
});
}
}
tarification-titre.response.ts
// Definition of interfaces used in the response
export interface TarificationTitreResponse {
PLN_PLC: PlnPlcInfo[];
}
export interface PlnPlcInfo {
PLACECODE: number;
PLACELABEL: string;
PLN_SVM: PlnSvmInfo[];
}
// More interfaces defined...
todo.component.html
<div class="container text-center">
<h2 class="pt-3 pb-3">HTML Table</h2>
<div class="row justify-content-center">
<div class="col-12 col-sm-6 col-md-4">
<div class="mb-2 d-flex align-items-center">
<!-- Plan input field -->
<label for="plan" class="mr-2" style="margin-right: 4px;">Plan</label>
<input type="text" id="plan" name="plan" class="form-control w-60" [(ngModel)]="planFilter" (ngModelChange)="filterByPlan()" placeholder="Filter by PLAN">
</div>
</div>
</div>
<table class="mb-5">
<tr>
<th>Client Rate 1</th>
<th>SVM</th>
<th>ISIN</th>
<th>Name</th>
<th>Place</th>
</tr>
// HTML table content rendering...
</table>
</div>