如何在Angular 2 Material 2中更改md-autocomplete宽度?
发布时间:2020-12-17 17:28:27 所属栏目:安全 来源:网络整理
导读:我坚持让md-autocomplete的宽度增长到相关mdInput的大小. 这是我的代码: div class="field" md-input-container class="halfWidth" input mdInput type="text" name="country" [(ngModel)]="model.Country" (ngModelChange)="filterCountries()" [disabled]
|
我坚持让md-autocomplete的宽度增长到相关mdInput的大小.
这是我的代码: <div class="field">
<md-input-container class="halfWidth">
<input mdInput
type="text"
name="country"
[(ngModel)]="model.Country"
(ngModelChange)="filterCountries()"
[disabled]="progress"
[mdAutocomplete]="countriesAutocomplete"
placeholder="Country"
required />
</md-input-container>
<md-autocomplete #countriesAutocomplete="mdAutocomplete"
[displayWith]="getCountryName">
<md-option *ngFor="let country of countries"
[value]="country"
class="fullWidth">
{{ country.PersianName || country.EnglishName }}
</md-option>
</md-autocomplete>
</div>
这是结果图:
我使用了md-autocomplete和md-autocomplete .mat-autocomplete-panel CSS选择器,但没有结果. 解决方法
我想我找到了答案.我想提醒一下,这是一个试验n错误,我还没有检查这个的后果.请谨慎使用.
这对我有用.. 我在我的全局CSS文件中为类.cdk-overlay-pane将max-width属性设置为’none’,将width属性设置为’auto’,它似乎已经解决了我的问题.希望它有所帮助…干杯!快乐的编码…… (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |

