I need to create dynamic drop downs, where the button label that toggles the dropdown, as well as the items come from a web service.
Im unable to make it work. If possible, please provide a working example.
This is what i've tried so far.
Hello,
Thank you for posting on our forums.
The reason why you get this error is because {{ rootMenu.CodigoMenu }} is pointing towards a string in your data. Furthermore, since @ViewChild does not support dynamic parameters, im not really sure you can even do such attribute assignment. Just change it to #dropdown and it should all work as intended.
Why do you need to assign dynamic values to the elements in html?
I believe all you need to do is to remove the {{ }} and the sample will run.
I've created one using the samples from our documentation:
https://stackblitz.com/edit/github-dropdowns?file=src%2Fapp%2Fdropdown-sample-1%2Fdropdown-sample-1.component.html
Please let me know if you have further questions.
Sincerely,
Tihomir TonevAssociate Software DeveloperInfragistics
Thank you for your quick response.
Im trying to build a customizable menu, where the relationship is configured through DB. Since I have only two levels (Root and child elements) I thought I could do it with dropdows.
So, each button A.K.A "root element" needs to have its own child elements. In tha sample you provided, they all share the same drop down items.
Is it possible to accomplish my needs with drop downs?
Thanks!
Thank you Tihomir! Thats exactly what I needed.
Yes this is possible, you just need to bind to your data source and have the dropdown items be correctly bound to the items which will be the options. I have updated the sample where I create a dropdown for each item in the data source, and each dropdown uses the options of this item.
https://stackblitz.com/edit/github-dropdowns?file=src%2Fapp%2Fdropdown-sample-1%2Fdropdown-sample-1.component.ts