I am currently delving into the realm of typescript/angular2+ as a fledgling student, and I have taken on the task of creating a website to put my newfound knowledge to the test.
The view is up and running, but I'm facing some roadblocks as I work on developing the update page.
On this update page, I have 2 select dropdowns and a table with checkboxes that can be selected.
For the selects, I'm utilizing the (valueChanged) event to capture the selected id.
Within the table, I'm using [(ngModel)] to handle the checkbox selections.
Essentially, the process I'm trying to achieve involves:
- Acquiring the id from the first select dropdown
- Selecting one or more products from the table using checkboxes
- Retrieving the id from the second select dropdown
Upon selecting checkboxes, I receive an array with product information. However, I only need the ids from this array to be sent to the backend. The challenge is that I require these ids to be in an array format, as per the configuration of my backend, which accepts data in the form of a list using a Data Transfer Object (DTO).
Here's an example of the array structure:
[{"id": 2225, "name": "Joy Price", "isSelected": true}, {"id": 2226, "name": "Ronnie Jordan", "isSelected": true}]
To sum up, I need to extract the ids from the checkedCategoryList and assemble a separate array to submit to the idsProducts field in the model.
I'm currently stuck on how to best approach this issue and would appreciate any guidance on how to proceed.
update.component.html
// HTML code snippet for the update component
update.component.ts
// Typescript code snippet for the update component
update.model.ts
// Typescript code snippet for the update model component
update.service.ts
// Typescript code snippet for the update service component