I have three Apis for categories,subcategories and policies.
For eg:
"https://restapi.com/project".
1.Category
In the case of category, I have to pass the body(raw data) as above json for the above Api
{
"startIndex":"1",
"count":"150",
"groupBy":"category",
"searchTerm":"PROJECT:project1"
}
Api Response: Listed out all categories
{ "data":
[
{
projectName:null,
categoryName: category1,
subCategoryName:null,
controlName:null
},
{
projectName:null,
categoryName: category2,
subCategoryName:null,
controlName:null
}
so on....
]
}
2.subCategory
In the case of sub-category, I have to pass the body(raw data) as above json for the above Api
{
"startIndex":"1",
"count":"150",
"groupBy":"subcategory",
"searchTerm":"PROJECT:projectName1,CATEGORY: category1"
}
Api Response: Listed out all subcategory of category1(because we give searchTerm by categoryName)
{ "data":
[
{
projectName:null,
categoryName: null,
subCategoryName: subcategory1,
controlName:null
},
{
projectName:null,
categoryName: null,
subCategoryName: subcategory2,
controlName:null
}
so on....
]
}
2.Control
In the case of control, I have to pass the body(raw data) as above json for the above Api
{
"startIndex":"1",
"count":"150",
"groupBy":"subcategory",
"searchTerm":"PROJECT:projectName1,SUB-CATEGORY: subcategory1"
}
Api Response: Listed out all Control of subcategory1(because we give searchTerm by subcategoryname)
{ "data":
[
{
projectName:null,
categoryName: null,
subCategoryName: null,
controlName: control1
},
{
projectName:null,
categoryName: null,
subCategoryName: null,
controlName: control2
}
so on....
]
}
When I open the 1st policy and after that, I open the next one. But the categories of second policy is automatically updated in first policy.
For calling these Apis, I used three get method for getCategory(),getSubcategory(),getControl().
I am attaching stackblitz example..
In stackBlitz I used three methods(like the method which I used)
ie,
open(i)====> I take index,i value for taking the policy values(but in my Api, I have to sent categoryName to get subcategory)
subOpen(i)====> I take index,j value for taking the subCategory values(but in my Api, I have to sent subCategory to get controls)
Here, https://stackblitz.com/edit/angular-9q4fbn?file=src%2Fapp%2Fapp.component.html.
Can you please tell me how to solve this??