https://jsonplaceholder.typicode.com/posts我必须从此链接中获取数据并将其显示在我的浏览器中。在 Javascript 中,我曾经使用 XMLHttpRequest 来完成它,然后使用 JSON.parse(response) 解析它。有没有办法可以在 angularjs 中实现类似的东西。谢谢
您可以查看此链接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.
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句