You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to things dynamically, we may not be able to have a single typeahead property in the component for each input. For instance, if you want to have a bunch of fields within an *ngFor, you wouldn't be able to give each their own template ref. Instead, they would be referenced by a QueryList like so:
If I wanted to also dynamically create a function that uses a specific NgbTypeahead, like below (see the comment in the code with an arrow), I would not be able to uniquely pick one of them out of a QueryList:
Right now, a very hacky workaround to get this functionality to work would be something like this, where fieldConfigs is an array of values describing how the dynamic content will work:
If there was a field named id on NgbTypeahead (and other components), you would be able to do this instead for the above example which is must easier to follow:
Basically I'm creating a data table component that is created by passing in configuration for each column. The column config contains things like this:
I would like that LookupFunction type to be as barebones as possible. Basically it just makes a request and that's it. That works fine, except for when you try to construct the debounced Observable like in my code in the original description. In there, I need to be able to access the individual instance of Typeahead.
Since I am generating content dynamically in an *ngFor over the column configs, I am not able to have a single field. Because of that, I need to use the @ViewChildren annotation and go through each of them.
Right now, there's no way to uniquely identifying it without the semi-hacky example I also put above.
When trying to things dynamically, we may not be able to have a single typeahead property in the component for each input. For instance, if you want to have a bunch of fields within an
*ngFor
, you wouldn't be able to give each their own template ref. Instead, they would be referenced by aQueryList
like so:If I wanted to also dynamically create a function that uses a specific
NgbTypeahead
, like below (see the comment in the code with an arrow), I would not be able to uniquely pick one of them out of aQueryList
:Right now, a very hacky workaround to get this functionality to work would be something like this, where fieldConfigs is an array of values describing how the dynamic content will work:
If there was a field named
id
on NgbTypeahead (and other components), you would be able to do this instead for the above example which is must easier to follow:Let me know if you need me to provide a StackBlitz, but as this is a feature request I feel like it's fine to omit one.
Versions of Angular, ng-bootstrap and Bootstrap:
Angular: Latest
ng-bootstrap: Latest
Bootstrap: Latest
The text was updated successfully, but these errors were encountered: