md-autocomplete

Angular Material - md-autocomplete dropdown's width

瘦欲@ 提交于 2019-12-20 03:21:44
问题 I'm using md-autocomplete from Angular Material: here It seems the dropdown's width goes with the input field's width. If an item's text is too long, there is ellipsis . However, I want to show full text of an item, while keeping the input field's width relatively short. That is, the dropdown's width should expand with its content. I tried inspecting the styles of md-autocomplete 's elements, but couldn't find any style that does the trick. Any idea? EDIT: Here are the style I ended up having

md-chips and md-autocomplete input field

∥☆過路亽.° 提交于 2019-12-12 03:55:40
问题 When user enters an input with md-chips and the focus is removed the entry is still there. is there a way to delete any entry that is not a chip once the focus is removed? The Out Standing Text still shows once the focus is removed 回答1: Normally, you should be able to do it by using ng-blur but for some reason there is an issue with that directive in use with md-autocomplete : https://github.com/angular/material/issues/3906 But i tried to solve it differently, not the most correct way, but it

Value not displaying for Material2 Autocomplete

佐手、 提交于 2019-12-10 17:58:13
问题 I am trying to get the autocomplete to display one parameter of object but save another and so far it doesn't seem to be behaving. Code is as per Material2 Autocomplete site: Autocomplete The difference is that [value] i want to save 'option.Id' and not 'option'. The error is that while it records the option.Id it doesn't actually display the value in input field (leaves it blank). my-comp.html <md-input-container> <input type="text" mdInput [formControl]="myControl" [mdAutocomplete]="auto">

material 2 Autocomplete: select option

自古美人都是妖i 提交于 2019-12-06 16:44:22
问题 I want to call a function when an option is selected. After some search it seem that i have to use : property optionSelections of MdAutocompleteTrigger In the documentation : https://material.angular.io/components/component/autocomplete optionSelections Stream of autocomplete option selections. I dont understand that , what is a stream, how to implement this ? 回答1: On md-option you can set "onSelect" <md-autocomplete #auto="mdAutocomplete"> <md-option (onSelect)="callSomeFunction()" *ngFor=

material 2 Autocomplete: select option

99封情书 提交于 2019-12-04 22:22:46
I want to call a function when an option is selected. After some search it seem that i have to use : property optionSelections of MdAutocompleteTrigger In the documentation : https://material.angular.io/components/component/autocomplete optionSelections Stream of autocomplete option selections. I dont understand that , what is a stream, how to implement this ? On md-option you can set "onSelect" <md-autocomplete #auto="mdAutocomplete"> <md-option (onSelect)="callSomeFunction()" *ngFor="let state of states" [value]="state.name">{{ state.name }}</md-option> </md-autocomplete> Since beta 3,

Angular Material - md-autocomplete dropdown's width

狂风中的少年 提交于 2019-12-02 02:06:40
I'm using md-autocomplete from Angular Material: here It seems the dropdown's width goes with the input field's width. If an item's text is too long, there is ellipsis . However, I want to show full text of an item, while keeping the input field's width relatively short. That is, the dropdown's width should expand with its content. I tried inspecting the styles of md-autocomplete 's elements, but couldn't find any style that does the trick. Any idea? EDIT: Here are the style I ended up having: .md-autocomplete-suggestions-container{ overflow-y:scroll } .md-autocomplete-suggestions-container

(onSelectChange) output for mdOption ALWAYS gets passed first item in list

久未见 提交于 2019-12-01 10:49:54
I'm using Angular Material for Angular 4 (4.3.4) and I need to hook into the selection event to clear the input and store the object in a separate list. But there's a problem: the onSelectChange output ALWAYS gets the first item as the parameter! What's going on? Here's my template: <md-autocomplete [displayWith]="displayRole" #auto="mdAutocomplete"> <md-option *ngFor="let role of roles | acrole: roleField.value | slice:0:4; let i=index;" [value]="role" (onSelectionChange)="AddRole(role)" > <div class="label"> {{role.label}} </div> </md-option> </md-autocomplete> And here's my AddRole function

(onSelectChange) output for mdOption ALWAYS gets passed first item in list

六月ゝ 毕业季﹏ 提交于 2019-12-01 09:36:57
问题 I'm using Angular Material for Angular 4 (4.3.4) and I need to hook into the selection event to clear the input and store the object in a separate list. But there's a problem: the onSelectChange output ALWAYS gets the first item as the parameter! What's going on? Here's my template: <md-autocomplete [displayWith]="displayRole" #auto="mdAutocomplete"> <md-option *ngFor="let role of roles | acrole: roleField.value | slice:0:4; let i=index;" [value]="role" (onSelectionChange)="AddRole(role)" >