Coder Social home page Coder Social logo

Dynamic list values about ng2-select HOT 17 OPEN

valor-software avatar valor-software commented on June 11, 2024 1
Dynamic list values

from ng2-select.

Comments (17)

jkwiz avatar jkwiz commented on June 11, 2024 14

I think this is the same problem I was having on RC.4 and 1.0.3.

I fixed it by putting the ng-select inside an ngIf.

<div *ngIf="clients.length > 0"> ... </div>

from ng2-select.

twaldron avatar twaldron commented on June 11, 2024 3

@jkwiz if it used to work, this doesn't now.
Not your fault, but this is a terrible miss by Valor and it seems like they have abandoned it.

from ng2-select.

JimJafar avatar JimJafar commented on June 11, 2024 2

This might help: #635 (comment)

from ng2-select.

Daeluse avatar Daeluse commented on June 11, 2024

This functionality is pretty important at this point, I've looked through the proposed async solutions posted elsewhere and most of them seem 'hacky' or just plain don't work. Is there any ETA on when this library will support change detection and allow us to add items asynchronously?

from ng2-select.

curlyfro avatar curlyfro commented on June 11, 2024

+1

from ng2-select.

Kasper86 avatar Kasper86 commented on June 11, 2024

+1
@jkwiz Thanks! That worked like a charm!!

from ng2-select.

GreenRover avatar GreenRover commented on June 11, 2024

+1

from ng2-select.

slimshady5 avatar slimshady5 commented on June 11, 2024

+1

from ng2-select.

toke182 avatar toke182 commented on June 11, 2024

Fixed this in #610

from ng2-select.

sujitnale123 avatar sujitnale123 commented on June 11, 2024

@jkwiz Thanks! That worked like a breeze

from ng2-select.

farhaan008 avatar farhaan008 commented on June 11, 2024

I also faced the same issue. I used *ngIf="data.length!=0" to resolved it( this solution hide select for first time).
but i found new way to resolve it, assign a empty value to it like
public data:any = [ {id: '', text:' '} ];
hope it will help you.

from ng2-select.

PuneetChauhan1 avatar PuneetChauhan1 commented on June 11, 2024

not working yet..

from ng2-select.

ChandraTerli avatar ChandraTerli commented on June 11, 2024

I am still having issue binding data to ng2-select, can anybody help please?
<ng-select [multiple]="true"
[items]="items" >

items: Array = [
{ "id": 1, "text": "Table" },
{ "id": 2, "text": "Chair" },
{ "id": 3, "text": "Light" }

];

from ng2-select.

leandromatilla avatar leandromatilla commented on June 11, 2024

Component will not detect a change. Instead you need to do:

this.items = [...this.items, {id: 1, name: 'New item'}];

from ng2-select.

leandromatilla avatar leandromatilla commented on June 11, 2024

I fixed it by putting the ng-select [items] value with "async".

<ng-select
[items]="dropdownList | async">

from ng2-select.

lygstate avatar lygstate commented on June 11, 2024

Component will not detect a change. Instead you need to do:

this.items = [...this.items, {id: 1, name: 'New item'}];

Good:)

from ng2-select.

nikhilkhot46 avatar nikhilkhot46 commented on June 11, 2024

this.items = [...this.items, {id: 1, name: 'New item'}];

Solved my Problem
Thanks

from ng2-select.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.