2016-11-15 135 views
1

我有一个像下面即两个输入元素..(搜索&,P:自动完成),我需要知道如何填充对自动完成输入字段,当我在搜索输入框输入一些角2号码:自动完成自动更新

<div style="vertical-align: middle"> 
    <span style="margin-left:118px;width:169px;font-style: normal; font-family: Verdana; color: #949494; font-size: 11px; font-weight: bold; text-decoration: none;">Search Job: </span> 
    <input type="text" id="searchVal" name="searchVal" style="width:448px;height:21px" #search="ngModel" [(ngModel)]="searchVal" (keyup)="searchonKeyEvent($event)" (mouseup)="searchMouseEvent($event)" /> 
    <input type="button" id="searchPABtn1" [ngClass]="{'disable-Button':!enableSearchButton,'submit-button':enableSearchButton}" 
[disabled]="!enableSearchButton" (click)="searchJobNames(searchVal)" value="Search" style="margin-bottom:10px;width: 100px;margin-left:6px"> 
    </div>     
</div> 

<div style="vertical-align: middle"> 
    <span style="float: left;width:700px;margin-left: 106px"> 
    <span style="width:169px;font-style: normal; font-family: Verdana; color: #949494; font-size: 11px; font-weight: bold; text-decoration: none;">Job Name:<em class="required">*&emsp;</em></span> 
    <div style="display:inline"> 
    <p-autoComplete name="projectCode" [(ngModel)]="projectCode" [suggestions]="filteredJobs" (completeMethod)="filteredJob($event)" [size]="30" 
     [minLength]="1" placeholder="" [dropdown]="true" (onSelect)="onSelectUpdateValue()" (mouseup)="clearMouseEvent($event)" (onDropdownClick)="handleDropdownClick($event)" #update="ngModel"> 
    <template let-job> 
     <div class="ui-helper-clearfix" style=""> 
      <div style="font-size:13px;float:left;">{{job}}</div> 
     </div> 
    </template> 
    </p-autoComplete> 
    </div> 

回答

1

不知道到底你尝试什么来完成,但我想这是你在找什么:

<input type="text" [(ngModel)]="searchVal" (ngModelChange)="projectCode = $event" 
+0

谢谢。它的工作 –