node.js 서버는 "This is a string"을 제공합니다. (writeHeader, write (string), end).
$ http 요청을 수행 할 때 node.js 서버가 응답하고 정보를 다시 보내는 것으로 나타납니다. I는 다음 요청을 수행 각도에서
:
angular.module('phoneList').
component('phoneList', {
templateUrl: 'phone-list/phone-list.template.html',
controller: function PhoneListController($http) {
var self = this;
$http.get('http://127.0.0.1:8081/echo').then(function(response) {
self.data = response.data;
}, function(err) {
self.error = err;
self.status = response.status;
self.statusText = response.statusText;
});
}
});
응답
{ "데이터"널 "상태"- 1 "구성"{ "방법" : "null", "transformResponse": [null], "url": "http://127.0.0.1:8081/echo", "헤더": { "Accept": "application/json, text/plain, / "}},"statusText ":" "}
node.js 또는 HTML 텍스트에서 JSON을 보내는 데 모두 시도했습니다. 차이 없음.
' "상태"를
무거운 물건 : 당신은을 통해 Node.js를 서버 파일에 해결할 수 -1' 일반적으로 백엔드를 사용할 수없는 것을 의미한다. CORS'allow-origin' 문제 일 수 있습니다. 콘솔에 오류가 있습니까? – dex