0
首例工作
angular.module('tss.application').controller("UserspaceController", function($scope, $http)
{
$http(
{
url : "/dirlist",
method : "GET",
}).then(function successCallback(response)
{
$scope.lists = response;
},
function errorCallback(response)
{
window.alert("Dir list could not be get");
});
});
第二种情况
angular.module('tss.application').controller("UserspaceController", function ($scope, $http)
{
$http.get('dirlist').success(function(data)
{
$scope.lists = data;
});
});
我是很新的Angularjs所以这可能是一个愚蠢的问题。无论如何, 列表变量的作品在第二种情况下,但在第一。也就是说,第二个可以访问控制器内的“列表”的值。我不明白第一个案件有什么问题?