I am new in Angular JS and I want to display a php array in ng-repeat. here is my html code,
<div ng-controller="clientList">
<ul>
<li ng-repeat="client in clients">
<h2>{{client.job}}</h2>
</li>
</ul>
<p>Total number of phones: {{clients.length}}</p>
</div>
Here is my Controller of Angular JS,
var anguApp = angular.module('anguApp', []);
anguApp.controller('clientList',function($scope,$http)
{
$scope.clients=[];
$http.get('customers.php').success(function (data, status) {
$scope.clients = data;
console.log(data);
});
});
customers.php
<?php
$arr=['name'=>'David','job'=>'developer'];
header('Content-Type: application/json');
echo json_encode($arr);
?>
Console Log :
getting response in console finely. but not getting in browser. where is the error ?....