[Angular Material] input 配 autocomplete 做法範例
HTML
<!-- 職業別 -->
<div>
<mat-form-field style="width:75%">
<input
matInput
placeholder="選擇職業別"
[matAutocomplete]="careerChoose"
/>
</mat-form-field>
<mat-autocomplete #careerChoose="matAutocomplete">
<mat-option
*ngFor="let careerTypeOption of careerTypeOptions"
[value]="careerTypeOption"
>
{{ careerTypeOption }}
</mat-option>
</mat-autocomplete>
</div>
TS
careerTypeOptions: string[] = [
'(A)農林漁牧礦',
'(B)軍警消公教',
'(C)製造業',
'(D)醫療保健及社會工作服務業',
'(E)批發及零售、流通業',
'(F)住宿及餐飲業',
'(G)藝術、娛樂及休閒服務業',
'(H)金融(銀行、證券、期貨、信託、融資性租賃等)',
'(I)資訊、科技業',
'(J)營建業',
'(K)律師、會計師、不動產經紀業',
'(L1)家管',
'(L2)退休',
'(L3)學生',
'(L4)自由業',
'(L5)其他:',
'(M)珠寶業、銀樓、典當業',
'(N)酒家、舞廳、電玩等特種行業',
'(O)博弈業、軍火商',
'(P)公證人、地政士、記帳士暨記帳及報稅代理人',
];
留言
張貼留言