4
我正在開發角度2應用程序,在我當前的項目中我希望顯示基於year,make,model的下拉值的功能。例如,如果我選擇本田,然後在模型下拉列表中只顯示本田模型。如何在angualr 2應用程序中使用typescript顯示基於其他下拉值的下拉值
默認情況下,我將綁定年份,品牌和型號的完整數據。
這是我的看法。
VehicleComponent.html
<div class="row form-group">
<div class="col-md-3">
<label class="control-label">Year*</label><br />
<select friendly-name="Year" id="year" name="year" class="col-md-6 form-control" ng-required="true" onchange='OnChange()' >
<option>Select</option>
<option *ngFor='let type of lookupdetailsvehicleyearinfo'>{{type.LookupValue}}</option>
</select>
</div>
<div class="col-md-3">
<label class="control-label">Make*</label><br />
<select friendly-name="Make" class="col-md-6 form-control" ng-required="true" >
<option>Select</option>
<option *ngFor='let type of lookupdetailsvehiclemakeinfo'>{{type.LookupValue}}</option>
</select>
</div>
<div class="col-md-3">
<label class="control-label">Model*</label>
<select friendly-name="Model" class="col-md-6 form-control" ng-required="true" >
<option>Select</option>
<option *ngFor='let type of lookupdetailsvehiclemodelinfo'>{{type.LookupValue}}</option>
</select>
</div>
</div>
我會從我自己的API的上述數據。
您能否告訴我如何在angular 2應用程序中爲上述功能編寫打印腳本代碼。
-Pradeep
上面的代碼工作正常,但對於我的情況,我需要檢查如果條件ID爲我收集的不是一個值英寸 – pradeep
通過使用這行代碼我得到了ID值,但在組件文件中我檢查如果條件與選定的身份證,如果條件我不知道如何將結果添加到收集使用打字稿。 – pradeep
使用'selectedIndex'查看我的更新。 – mxii