我正在使用Angular2并且其中包含来自
的值情景: -
Chrome和Edge中出现同样的问题...
HTML
<md-input-container>
<input mdInput placeholder="Enter Code" [mdAutocomplete]="auto"
[formControl]="stateCtrl">
</md-input-container>
<md-autocomplete #auto="mdAutocomplete" md-no-cache="true">
<md-option *ngFor="let c of codeNumbers " [value]="c">{{c}}</md-option>
</md-autocomplete>
打字稿
export class VehicleComponent implements OnInit
{
public codeNumbers: any[];
stateCtrl: FormControl;
public myForm: FormGroup;
constructor()
{
this.stateCtrl = new FormControl();
this.stateCtrl.valueChanges.subscribe(name =>
{
if (name.toString().length >= 5)
{
this.GetCode((name) as string);
}
else
{
this.codeNumbers = null;
}
});
}
}
请求的Getcode()方法
public GetCode(code:string)
{
"use strict";
this.CodeService.GetCODEData(code).subscribe(result => {
this.codeNumbers = ((result) as any);
});
}
附件显示问题 - 任何帮助高度赞赏......