1
AngularJSの<select>
HTML要素のoptions
をデータベースから取得した値で動的に設定しようとしています。ドキュメントによると、私はこれを試しました:Angularjs:動的に値が設定されたオプションselectが値の代わりにオブジェクトを返します
<select
name="student_id"
ng-model="studentData.student_id"
ng-options="student as student.name for student in students track by student.id"
class="form-control">
<option value="">-- choose Agency --</option>
</select>
これはうまくいきました。 option
select
HTML要素に値が設定され、生徒の名前が入力されたドロップダウン値が表示され、option
要素の対応する値はstudent_id
でした。
の問題は、今私は、すべてのフォームに必要事項を記入して提出しようとしたとき、それは代わりにの学生オブジェクトを提出option select
要素の値としてをSTUDENT_IDということです。
は、どのように私の代わりに学生対象のstudent_id
を提出するのですか?