、私は複数のドロップダウンボックスが必要です。すべてのデータは私のAPIのjsonからのものです。私の問題は、私はAPIからデータを設定する方法を知っていますが、ここで私は3つの異なるURLを持っています。選択した国に応じてドロップダウンを行います。 (url:blabla/countries)、次に2番目のドロップダウンで選択した国(url:blabla/countries/countryId/states)と3番目のドロップダウンで州を設定する必要がある選択された州(url:blabla/countries/countryId/states/statesId/city)。 選択した国または州のIDを次のドロップダウンボックスのURLに追加する方法がわかりません。ウェブアプリケーションにドロップダウンの角度を掛ける
$http.get('url')
.success(function(response)
{$scope.countryes=response;});
<div>
Country:
<select id="country" ng-model="country" ng-options="country.id as country.name for country in countryes">
<option value=''>{{countryes.name}}</option>
</select>
</div>
<div>
States <select id="city" ng-disabled="!country" ng-model="suburbs" ng-options="state as state.name for state in states"><option value='state'>Select</option></select>
</div>
<div>
City <select id="suburb" ng-disabled="!suburbs" ng-model="suburb" ng-options="suburb for suburb in suburbs"><option value=''>Select</option></select>
</div>
のthnx郡と状態のため、誰も
thnxですが、どこのIDが設定されていますか? – Arter
これはng resourceとng-changeで行います。そして、最初のドロップダウンで私はすべての国のリストを持っています。今問題は、次のドロップダウンのIDを設定する方法ですか? Url Myapiurl/country /:countryID/statesのようになります。私はcountryid、選択された国のidに設定する必要があります。私はリソースにadd(countryid:@ country.id)を試みますが、動作しません。誰かが私にidを設定する方法を説明することはできますか?別のAppで私はこれを行うが、URLの最後の位置にIDがあった。どのようにidを設定する必要があるときに変更するURLの真ん中に? Thnx – Arter
モデル国IDがng-model = 'country'の場合、 '$ scope.country'はcontry idです – aseferov