2
對不起,如果這已被回答之前,但我找不到相關的答案。我是Ruby on Rails API和Angular的新手,所以任何幫助,將不勝感激。吳重複與角落下拉菜單和Ruby on Rails API
我的API有2個型號。 「物業」模式具有「形象」和「價格」的屬性。 「地點」模型具有「位置」的單一屬性,並且該模型也在屬性模型內引用。
我很努力地使用語法向下鑽取數據並填充頁面上的位置列表來編輯屬性信息。在下面的代碼中,圖像更新正在工作(網址爲字符串),但我無法在下拉菜單中看到數據。
<form ng-submit="propertiesEdit.update()">
<div>
<label>Image</label>
<input type="text" ng-model="propertiesEdit.property.image">
</div>
<div>
<label>Location</label>
<select ng-model="propertiesEdit.property.place">
<option disabled selected value="">Please select</option>
<option ng-repeat="property in propertiesEdit.property.place" ng-value="{{ place.id }}">{{ propertiesEdit.property.place.location }}</option>
</select>
</div>
</form>
你這個'propertiesEdit.property.place'的值賦給這個'property'和你所訪問每個項目通過這個'propertiesEdit.property.place.location'?用'property.location'代替它?你做到了嗎? – Roljhon
是的,我試過,但位置是在裏面的地方,所以它不工作。不管怎麼說,還是要謝謝你。 –
如果'propertiesEdit.property.place'實際上是一個具有'location'屬性的對象列表的數組,那麼它應該可以工作,如果不是,那麼它肯定不會工作。如果您希望我們提供幫助,您應該爲我們提供大量信息,以便密切地複製您的問題。 – Roljhon