javascript - Angular REST data not displaying in view correctly -


heres angular app:

app.controller("appctrl", function ($scope, $http, $q) {

$q.all([ $http.get('http://private-bc4b97-commutertransport.apiary-mock.com/bus'), $http.get('http://private-bc4b97-commutertransport.apiary-mock.com/otm')  ]).then(function(results) {  $scope.network = results[0].data;  $scope.data = results[1].data  })  }); 

the html:

<div class="main" ng-controller="appctrl"> <h1>{{network.test1}}</h1> <h1>{{data.test2}}</h1> </div>  

and basic json (in different url each other of course):

"test1" : "first test", "test2" : "second test", 

now console showing http being called data isn't being displayed in view... not sure whats wrong?

console log screen:
enter image description here

enter image description here

try logging response in console; in experience angular's $http service (when using .then method), response data wrapped in response object , returned in data property of object:

$scope.network = results[0].data; $scope.data = results[1].data; 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -