Label,value pair in MDB pro autocomplete for Angular


Topic: Label,value pair in MDB pro autocomplete for Angular

aleksandars2b pro asked 7 years ago

I can't seem to figure out what seems like an obvious thing to me, Im passing a service to autocomplete which returns objects with Label and Value  field, I want to show the labels to users to autocomplete but I need to pass on the Value field?

NCIIT answered 7 years ago

I have the same issue, would like to have "value" / "label" pair for autocomplete to pass "value" when form submitted

For now used (selected) EventEmitter  of completer

<mdb-completer [label]="'Search'" name="autocomplete" placeholder="search" [(ngModel)]="tag" [datasource]="tagList" [minSearchLength]="2" #item (selected) = "onAddTag($event)"></mdb-completer>

Answer found here

onAddTag = function(selectedObject: any) {
 console.log(selectedObject.originalObject);
};

 


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No