https://jsonplaceholder.typicode.com/posts我必须从此链接获取数据并在浏览器中显示。在Javascript中,我曾经使用XMLHttpRequest做它,然后使用JSON.parse(响应)解析它。有没有办法在angularjs中实现类似的东西。谢谢
答案 0 :(得分:1)
您可以查看此链接angular http get
<强>样品强>
$http({
method: 'GET',
url: '/someUrl'
}).then(function successCallback(response) {
// this callback will be called asynchronously
// when the response is available
}, function errorCallback(response) {
/ / called asynchronously if an error occurs
// or server returns response with an error status.
});