I'm new to angularjs. I'm trying to display data from a php controller returned to server. I'm fetching that data in angular but there is a problem since data is not getting displayed. my code is attached. Controller Action Method
public function actionAhmed(){
$unit = Units::model()->findAll();
$unitList = array();
foreach($unit as $value){
$unitList[] = $value->attributes;
}
return json_encode($unitList);
}
Angular Controller
var myModel = angular.module('MyModel', []);
app.controller('myCtrl', function($scope, $http) {
$http.get('http://localhost/tutorial/index.php/units/ahmed')
.then(function (response) {
$scope.parsedData = response.data;
});
});
HTML code
<div ng-app="MyModel" ng-controller="myCtrl">
<ul>
<li ng-repeat="x in parsedData">
{{ x.Name + ', ' + x.Country }}
</li>
</ul>
</div>