md-autocomplete displaying '[object Object]'
See original GitHub issueBug:
Md-autocomplete
displays [object Object]
even though it is passed a string. It displays that only if you select the same object from the dropdown list.
What is the expected behavior?
We should not see [object Object]
after selecting the same object from the options.
What are the steps to reproduce?
Here is a Plunker that reproduces the issue: https://plnkr.co/edit/acz2QZHuVo39rdOQ2C3E?p=preview
Select a value from the list. Then click on the input (without typing) and select the same value again (there should be only 1 value in the list - the current one).
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 4.3.2 Material 2.0.0-beta.8
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Angular AutoComplete is returning value as [Object Object]
To make this work, create a function on your component class that maps the control value to the desired display value. Then bind...
Read more >How to display and handle objects in mat-auto complete?
If you have array of objects to be shown in <mat-option> ,then you can use displayWith property. By using this property I will...
Read more >Directives > mdAutocomplete - AngularJS Material
Parameter Type Description
md‑search‑text expression expression A model to bind the search query text to.
md‑selected‑item object object A model to bind the selected item...
Read more >[Solved]-ng-autocomplete displaying '[object Object]'-angular.js
[Solved]-ng-autocomplete displaying '[object Object]'-angular.js ... Don't know why you getting this [object object] error but i made one stackblitz example for ...
Read more >Angular Material - Autocomplete - Tutorialspoint
The md-autocomplete, an Angular Directive, is used as a special input control with an inbuilt dropdown to show all possible matches to a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And if you still want to bind the value to
state
instead ofstate.name
, autocomplete has adisplayWith
input to control how the selected option gets displayed.Example: https://plnkr.co/edit/W9vdWaGcoG90LKM8hHgI?p=preview
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.