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.

  1. Try to set initial selected value by active:
<ng-select [allowClear]="true"
    [active]="roles[1]"
        [items]="roles"
        [disabled]="inProgress"
        (data)="setRole($event)"
         placeholder="Виберіть роль">
</ng-select>

No success. Maybe I am doing something wrong?

  1. If I loading items from host I have no results as long as I do not add *ngIf="someItems". If someItems loaded after then html view I will have 0 items in select.

Issue Analytics

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

github_iconTop GitHub Comments

6reactions
nigul2009commented, Mar 23, 2017

If you add the following lines to the ng-select component in the view

[items]="models"
[active]="somevariable"
(data)="refreshValue($event)"

And in your component you implement the assignment to the variable “somevariable” in the method “refreshValue”:

  public refreshValue(value: any): void {
        if (!this.somevariable && this.models.length > 0) {
            this.somevariable= [this.models[0]];
        }
        console.log('New search input: ', value);
    }  

it will work!

6reactions
harunurhancommented, Jul 21, 2016

I ended up implementing something similar but simple with ng2-bootstrap. You can have a look may be it will help you.

https://github.com/inspirehep/record-editor/tree/master/src/app/editor/searchable-dropdown

searchable-enum-dropdown-1 searchable-enum-dropdown-2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Start Value Definition | Law Insider
Define Start Value. means the hypothetical liquidation value (determined on a going concern basis) of the Class A Units (i.e., Book Value of...
Read more >
How to Value a Startup Company With No Revenue
Startup valuation is the process of calculating the value of a startup company. Startup valuation methods are particularly important because ...
Read more >
How to Value a Startup — 10 Real-World Valuation Methods
How to Value a Startup — 10 Real-World Valuation Methods · 1. Standard Earnings Multiple Method · 2. Human Capital Plus Market Value...
Read more >
PwC Deals insights: How to value a start-up business
Valuation of companies in Early Growth and Expansion stages might be based on the venture capital (VC) and discounted cash flows (DCF) methods....
Read more >
How to Value Your Startup - Entrepreneur.com
A company that could be worth $5 million at profitability will be worth some fraction of that number at the startup stage, based...
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