user3107804 user3107804 - 11 months ago 52
Ajax Question

Angular Js ng-repeat can't getting output from json array using ajax

I am using Angular Js having ajax but by using ng-repeat can't getting output from json array. On alert getting [Object object] on but by using

$scope.names= response[0].id;
, getting "1" id on alert. I need to get all data in table. Is there any way to get all data in table and also I am not using
in controller because it not working in mobile browser but works in desktop, i don't know why?Please help!


var app = angular.module('studentApp',[]);
app.controller('StudentCntrl', function($scope){

url : '/fetchAllData',
type : 'GET',
success : function(response){
//alert($scope.names);(This is working)


<div ng-app="studentApp" ng-controller="StudentCntrl">

<div class="table-responsive">
<table class="table table-striped">
<tr ng-repeat="x in names">




Answer Source

When updating the scope with an $ajax call (you should use $http), you have to use $scope apply to update your bindings.

    $scope.names =;