Promact / md2

Angular2 based Material Design components, directives and services are Accordion, Autocomplete, Collapse, Colorpicker, Datepicker, Dialog(Modal), Menu, Multiselect, Select, Tabs, Tags(Chips), Toast and Tooltip.
http://code.promactinfo.com/md2/
MIT License
379 stars 112 forks source link

Chips : autocomplete-item-value #240

Closed Dhursh closed 7 years ago

Dhursh commented 7 years ago

Bug, feature request, or proposal:

Bug

What is the expected behavior?

selected autocomplete-item-value value should return

What is the current behavior?

Throwing [object Object]. .html

<md2-chips required fxFlex="100%" name="to" #To="ngModel" [(ngModel)]="model.To" placeholder="To" [isRemovable]="true" [isAutoComplete]="true"
               (change)="handleChange($event)"  [autocompleteDataList]="userNameList" autocomplete-item-text="name" autocomplete-item-value="email" item-text="name" md-selected-item="name" #chipsControl="ngModel">
              </md2-chips>

.ts

 this.usersList = res;
        for (let i = 0; i < this.usersList.length; i++) {
          let obj : any ={};
          obj.name=this.usersList[i].emp_login;
          obj.email=this.usersList[i].emp_work_email;
          this.userNameList.push(obj);
        }

autocomplete-item-text is working. but autocomplete-item-value throwing Object itself.

Which versions of Angular, MD2, OS, browsers are affected?

Angular 2.4.x Os: Windows 10 MD2 : 0.0.17

dharmeshpipariya-zz commented 7 years ago

@Dhursh you have to set both objects with same property or set its specific property, refer API Docs, also please provide plunkr demo to more clear the issue, plunkr template is [Plunker template: http://plnkr.co/edit/rQmUz8WYRh5Vz4gwY8E4?p=info](Plunker template: http://plnkr.co/edit/rQmUz8WYRh5Vz4gwY8E4?p=info)

Dhursh commented 7 years ago

http://code.promactinfo.com/md2/#/chips Chips with AutoComplete example also not working, its throwing null