私はREST APIから得た応答に手動で値を追加して、ビュー内で使用しようとしています。問題は、ng-repeatの中に手作業で追加したアイテムにアクセスできないことです。私の例を説明しましょう。これは私がREST APIから得た検索応答です。このような検索応答に値を追加しました。はng-repeat内で値を取得できません
$scope.searchresponse = [{
"items": [{
"employeeId": "ABC",
"type": "D",
"alive": "Yes"
}, {
"employeeId": "DEF",
"type": "D",
"alive": "Yes"
}, {
"employeeId": "NPK",
"type": "D",
"alive": "Yes"
}, {
"employeeId": "PKN",
"type": "A",
"alive": "Yes"
}],
"more": false
}];
$scope.searchresponse.action = "Test"
console.log($scope.searchresponse);// I am able to see the test value here
これはどのように私は価値のテストが表示され得ることができます
<tr ng-repeat="details in searchresponse">
<td class=list align=center ng-switch="details.type">
<span
ng-switch-when="D">SINGLE</span><span
ng-switch-when="E">MULTIPLE</span>
<td> {{$scope.searchresponse.action}}</td> // - Tried this didnt work
<td> {{searchresponse.action}}</td> // - tried this didnt work .
</td>
私のHTMLです。別のスイッチのケースまたはng-ifの場合にその値を使用したいです
:だから、いくつかのデータは次のようになりますバインディング。私が抱えている唯一の問題は、後で 'searchresponse'に追加されたアクション変数にアクセスすることです – Praveen