Unable to programatically set active item
See original GitHub issueCurrently unable to programatically set active item.
Would be good to have option to do this via component logic, e.g.:
this.mySelectComponent.setActive([itemFromList]);
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:14
Top Results From Across the Web
Can't set active item of BottomNavigationView while recreating ...
Can't set active item of BottomNavigationView while recreating app: the last selected item is active after recreating app, so ...
Read more >Question: How to set active Item programmatically? #716
for me, the issue is when i am dynamically adding and removing items from the carousel (based on dispatching redux action creators and...
Read more >Programmatically set active menu item based on node taxonomy
No it's not few nodes. I am trying to have active menu item set all the time, even when viewing node. Have 2...
Read more >PrimeNG tabView - How to programmatically set active tab
I'm using PrimeNG tabView in an Angular 2 typescript project. Is it possible to set the active tab programmatically? I cannot see an...
Read more >Configure CollectionView item selection - .NET MAUI
None – indicates that items cannot be selected. ... When an item is selected, the SelectedItem property will be set to the value...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I meant to get back to this. A workaround is to use Angular2’s formbuilder and bind a formcontrol to the dropdown.
Markup:
<ng-select [multiple]="true" [items]="businessTypes" placeholder="No category selected" formControlName="businessType" id="businessType"></ng-select>
Logic:
this.myForm.controls['businessType'].setValue([businessType]);
Hope this helps! 😃
Same problem. I had active on template. active is told to be object in case of Single, and array of objects in case on Multiple, but the only way I can set active for Single is, if it’s array of single object. Would like it to really be only object.