これは私の角度コントローラです:
angular
.module('hameedApp', [])
.controller('hameedController', function($scope, $http) {
$http({
method: 'GET',
url: 'json.php'
}).then(function(response) {
$scope.contacts = response.data;
}).catch(function(response) {
console.log('error');
})
});
これはbodyタグから私のhtmlです:
<table class="table">
<tr>
<th>Name</th>
<th>Phone No</th>
<th>Email</th>
</tr>
<tr ng-repeat="contact in contacts">
<td>{{contact.name}}</td>
<td>{{contact.gsm}}</td>
<td>{{contact.email}}</td>
</tr>
</table>
<script>
var test = {{contacts}}
console.log(test);
</script>
私は「テスト」と呼ばれる一つの変数で{{contacts}}
完全な配列のJSONデータの上に取得したいです。
は可能ですか?
あなたは 'angularjs'として知っていたの下のように、
angular
コードからこのcallback
を使用することができ、このよう
window
に新しいmethod
を追加し、あなた<head>
での下を参照してください。まあ?前に 'angular.value'を使用しましたか?多分あなたの質問はあなたから試して行方不明! – Maher