📅  最后修改于: 2020-10-28 04:57:04             🧑  作者: Mango
md-autocomplete (一个Angular指令)被用作具有内置下拉菜单的特殊输入控件,以显示与自定义查询的所有可能匹配项。用户在输入区域中键入内容后,此控件就充当实时建议框。
下表列出了md-autocomplete不同属性的参数和说明。
Sr.No | Parameter & Description |
---|---|
1 |
* md-items An expression in the format of item in items to iterate over matches for your search. |
2 |
md-selected-item-change An expression to be run each time a new item is selected. |
3 |
md-search-text-change An expression to be run each time the search text updates. |
4 |
md-search-text A model to bind the search query text to. |
5 |
md-selected-item A model to bind the selected item to. |
6 |
md-item-text An expression that will convert your object to a single string. |
7 |
placeholder Placeholder text that will be forwarded to the input. |
8 |
md-no-cache Disables the internal caching that happens in autocomplete. |
9 |
ng-disabled Determines whether or not to disable the input field. |
10 |
md-min-length Specifies the minimum length of text before autocomplete will make suggestions. |
11 |
md-delay Specifies the amount of time (in milliseconds) to wait before looking for results. |
12 |
md-autofocus If true, will immediately focus the input element. |
13 |
md-autoselect If true, the first item will be selected by default. |
14 |
md-menu-class This will be applied to the dropdown menu for styling. |
15 |
md-floating-label This will add a floating label to autocomplete and wrap it in the md-input-container. |
16 |
md-input-name The name attribute given to the input element to be used with the FormController. |
17 |
md-input-id An ID to be added to the input element. |
18 |
md-input-minlength The minimum length for the input’s value for validation. |
19 |
md-input-maxlength The maximum length for the input’s value for validation. |
20 |
md-select-on-match When set as true, autocomplete will automatically select the exact item if the search text is an exact match. |
以下示例显示了md-autocomplete伪指令的使用以及自动完成的用法。
am_autocomplete.htm
结果
验证结果。