2
我使用兌現,CSS angular2-兌現與兌現,CSS與angular2工作。一切工作正常,即使正常的選擇組件。 問題是與多個選擇它不呈現動態值,我不明白,如果它的初始化對象或其他東西的問題,因爲它適用於正常的選擇,但如果我添加靜態選項和渲染後,如果我點擊該選項,然後更改事件被調用,然後如果我再次單擊它,所有這些動態值將被添加到組合。多選擇與angular2沒有渲染的動態值
以下是我的代碼,但如果沒有任何適當的解決方案,我可以使用任何解決方法或除materialize-css之外的任何其他框架,它經過測試並適用於angular2。
<div class="form-group">
<!--if i remoe multiple it works-->
<select
materialize="material_select"
multiple
(ngModelChange)="change($event)"
[ngModel]="prodmodel.CategoryId"
ngControl="CategoryId" #catid="ngForm">
<!--This options are not rendering-->
<option *ngFor="#p of categories"
[value]="p.id">
{{p.CategoryTitle}}
</option>
<!--This option will render and if i click it above options will render too but not in oproper way-->
<option value="0">chhose</option>
</select>
<label>select Category </label>
</div>
我的函數來獲取類:
getCategories() {
this._Categories.getCategories()
.subscribe(
Categories=> this.Categories= Categories,
error => this.errorMessage = <any>error);
}
哪裏了'categories'值來從? –
你可以嘗試用這個Plunker https://plnkr.co/edit/sQGRzC?p=preview重現嗎? –
嗨..還沒用過plunkr ..我怎麼能在那個plunkr中添加materialize-css和angular2-materialize? – noobProgrammer