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:
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
Post a Comment