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.

cant set active / selected items

See original GitHub issue

Hey, i am using ng2-select and i am quiet satisfied. I spent the last 3 hours to set the initial data of the select.

My first attempt was to use "active: code:

<ng-select  [active]="active"... 
public active = ['Amsterdam'];

Compiler:

Can’t bind to ‘active’ since it isn’t a known property of ‘ng-select’

After that I tried around with some hacks but so far I couldnt find a solution. I also want to use it as a multi select, but i am already failing on the single selection. Unfortunately there is no demo and i am out of ideas…

Another little thought: CSS height is not working correctly. I have to set the height initially but if it changes (like on multiselect), therefore the hight stays the same…

Thank you for this very helpful component!

Greetings Emanuel

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:17

github_iconTop GitHub Comments

7reactions
rubenkuiperscommented, Dec 19, 2016

I have found the solution, you need to set the active attribute like this: [active]=“[arrayWithObjects[objectIndex]]”

In most cases this means you should refactor your data object to this format to get It working.

5reactions
karmiscommented, Dec 8, 2016

[active]=“value[0]” must be the array

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 >
mdb-select not setting ACTIVE class for selected option
On page load, the form displays the previous selected item - ie the :selected item is displayed, but the .active class is NOT...
Read more >
8 reasons why you cannot select your object in Blender
Press P then choose selection or use "by loose parts" if you want to separate all loose individual mesh pieces into different objects...
Read more >
You are unable to select unprotected cells in Excel
Workaround · Do not clear the Select Locked Cells check box when you protect a worksheet: Start Excel, open your workbook, and then...
Read more >
Home - SET ACTIVE
Constructed by us, activated by you. Designed to flatter, sculpt and lift.
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