I have some category name in database, I want to pull the category names
and want show the category names as checkbox field in the reactive form in
angular 6.
The database category name are as below (id, category)
[image: Screenshot_4.png] <about:invalid#zClosurez>
I want to show this category name in the reactive form like below :
businessServices = [
{id: 25, business_type: "Business Insurance", slug: "business-insurance",
tooltip: "Tooltip", line_1: "Line one"},
{id: 34, business_type: "Self Employed", slug: "new-business-type", tooltip:
"One", line_1: "asdj"},
{id: 36, business_type: "Partnership", slug: "allows-you-to-add", tooltip:
"allows
you to add ", line_1: "dasa"},
{id: 39, business_type: "Limited Liability Partnership", slug:
"limited-liability-partnership", tooltip: "This is Limited Liability
Partnership", line_1: "Line one"},
{id: 40, business_type: "Software Quote", slug: "software-quote", tooltip:
"This
is tooltip", line_1: "Line one"},
{id: 41, business_type: "Company Formation", slug: "company-formation",
tooltip: "This is company formation", line_1: "Line one "}
];
const controls = this.businessServices.map(c => new FormControl(false));
this.packageForm = this.formBuilder.group({
businessServices: new FormArray(controls)
});
Above i have assigned the businessServices array with pre defined values,
but i want to get the values from the db using services like below is it
possible?
I this.categoryService.getCategory().subscribe(
(data) => {
for(let post of data){
this.businessServices.push(post);
}
this.changeDe.detectChanges();
});
[image: Screenshot_5.png] <about:invalid#zClosurez>
<about:invalid#zClosurez> <about:invalid#zClosurez>Services are business
fields names from db <about:invalid#zClosurez>Now what have i done till for
that: <about:invalid#zClosurez>
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.