question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to programatically set active item

See original GitHub issue

Currently 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:open
  • Created 6 years ago
  • Reactions:5
  • Comments:14

github_iconTop GitHub Comments

2reactions
kylestephenscommented, May 14, 2017

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! 😃

1reaction
alotnakcommented, Mar 29, 2017

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found