后台php echo回来的json格式的字符串,successCallback里面没有使用如JSON.parse(response)转成对象而是直接用了,是angular内部有对其处理么?
var app = angular.module('myApp', []);
app.controller('siteCtrl', function($scope, $http) {
$http({
method: 'GET',
url: 'https://www.runoob.com/try/angularjs/data/sites.php'
}).then(function successCallback(response) {
$scope.names = response.data.sites;
}, function errorCallback(response) {
// 请求失败执行代码
});
});