こんにちは私はangularjsでWebアプリケーションを開発しています。私はいくつかのドロップダウンと1つのHTMLフォームを持っています。私はドロップするデータを埋めるためにAPI呼び出しを行っています。 1つのコールで別々のコールを行う代わりに、すべてのドロップダウンをバインドするために必要なすべてのデータを取得しています。 私のサンプルデータは以下の通りです。anglejsのドロップダウンにオブジェクトの配列を割り当てる方法は?
{"status":"Success","msg":"Success","code":"200","data":{"Education":[{"ID":1,"Education":"btech"},{"ID":2,"Education":"Bcom"},{"ID":3,"Education":"BA"},{"ID":6,"Education":"PU"}],"MaritalStatus":[{"ID":1,"MaritalStatus":"sinle"},{"ID":2,"MaritalStatus":"married"}]}
私はそれを以下のようにドロップダウンしようとしています。コードの
var martialstatus = new Array();
var Education = new Array();
$http.get(baseurl + 'api' + '/Customer/' + 'PersonalInfoMasters').success(function (data) {
$.map(data.data, function (item) {
Education.push(item[0]);
});
console.log(Education);
}).error(function (status) {
});
Abobeピースは教育からの最初の項目、私は教育配列に教育オブジェクトをバインドしたい武術ステータスなどのように、各オブジェクトから私の最初の項目を取得します。コードの行がどこにないのか分かりますか?どんな助けもありがとう。
$.map(data.data.Education, function (item) {
Education.push(item[0]);
});
:
'$ .map(data.data.Education' Use this。 –