您好,我需要使用REST服务来显示网站(200,404等)的响应。
我创建了一个局部的代码,但我不知道如何显示结果
这是JS
angular.module('demo', [])
.controller('Hello', function($scope, $http) {
$http ({
method: 'GET',
url: 'http:/www.google.com'
}).
then(function(response) {
$scope.greeting = response.data;
});
})
,这是HTML
<body>
<div ng-controller="Hello">
<p>Result = {{greeting.content}}</p>
</div>
</body>
</html>
感谢您的帮助。
检查文档https://docs.angularjs.org/tutorial – mcranston18