oferh / ng2-completer

Angular 2 autocomplete component
http://oferh.github.io/ng2-completer/
MIT License
348 stars 171 forks source link

datasource doesn't update with new values #457

Open Nixon-Joseph opened 3 years ago

Nixon-Joseph commented 3 years ago

I have an instance where I need it to autocomplete different options depending on another input. When this value is updated, nothing changes in the completer, it always holds on to whatever list it hits first.

For instance: <ng2-completer [datasource]="propertyOptions[trigger.Property]" [minSearchLength]="1" [openOnFocus]="true" placeholder="Enter value" [(ngModel)]="trigger.Value"></ng2-completer>

Where propertyOptions is { [key: string]: Array<string>; }:

{
    "BrandName": [
        "Stanley",
        "BITLY",
        "Lufkin"
    ],
    "Class1": [
        "CLA9",
        "CLA15",
        "INV SENC"
        ......
    ]
}

trigger.Property is in an [(ngModel)] on a select.