AngularJS AJAX - $http
AngularJS AJAX - $http
$ http 는 원격 서버에서 데이터를 읽는 AngularJS 서비스입니다.
AngularJS $ http
AngularJS $http서비스는 서버에 요청을 보내고 응답을 반환합니다.
예
서버에 간단한 요청을하고 결과를 헤더에 표시하십시오.
<div ng-app="myApp" ng-controller="myCtrl">
<p>Today's welcome message is:</p>
<h1>{{myWelcome}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("welcome.htm")
.then(function(response) {
$scope.myWelcome = response.data;
});
});
</script>
[전체소스]
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<p>Today's welcome message is:</p>
<h1>{{myWelcome}}</h1>
</div>
<p>The $http service requests a page on the server, and the response is set as the value of the "myWelcome" variable.</p>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("welcome.htm")
.then(function(response) {
$scope.myWelcome = response.data;
});
});
</script>
</body>
</html>
$ http 는 원격 서버에서 데이터를 읽는 AngularJS 서비스입니다.
AngularJS $ http
AngularJS $http서비스는 서버에 요청을 보내고 응답을 반환합니다.
예
서버에 간단한 요청을하고 결과를 헤더에 표시하십시오.
<div ng-app="myApp" ng-controller="myCtrl">
<p>Today's welcome message is:</p>
<h1>{{myWelcome}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("welcome.htm")
.then(function(response) {
$scope.myWelcome = response.data;
});
});
</script>
[전체소스]
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body>
<div ng-app="myApp" ng-controller="myCtrl">
<p>Today's welcome message is:</p>
<h1>{{myWelcome}}</h1>
</div>
<p>The $http service requests a page on the server, and the response is set as the value of the "myWelcome" variable.</p>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope, $http) {
$http.get("welcome.htm")
.then(function(response) {
$scope.myWelcome = response.data;
});
});
</script>
</body>
</html>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 298 | CSS |
선택과집중
|
2개월 전 | 159 | |
| 297 | CSS |
선택과집중
|
3개월 전 | 360 | |
| 296 | CSS |
선택과집중
|
3개월 전 | 312 | |
| 295 | CSS |
선택과집중
|
4개월 전 | 292 | |
| 294 | CSS |
선택과집중
|
4개월 전 | 422 | |
| 293 | CSS |
선택과집중
|
4개월 전 | 371 | |
| 292 | CSS |
선택과집중
|
4개월 전 | 292 | |
| 291 | CSS |
선택과집중
|
5개월 전 | 295 | |
| 290 | CSS |
선택과집중
|
5개월 전 | 343 | |
| 289 | CSS |
선택과집중
|
5개월 전 | 314 | |
| 288 | CSS |
선택과집중
|
5개월 전 | 400 | |
| 287 | CSS |
선택과집중
|
5개월 전 | 347 | |
| 286 | CSS |
선택과집중
|
5개월 전 | 348 | |
| 285 | CSS |
선택과집중
|
5개월 전 | 366 | |
| 284 | CSS |
선택과집중
|
5개월 전 | 256 | |
| 283 | CSS |
|
2년 전 | 1526 | |
| 282 | CSS | 2년 전 | 2505 | ||
| 281 | CSS | 4년 전 | 4035 | ||
| 280 | CSS | 4년 전 | 4557 | ||
| 279 | 반응형웹 | 5년 전 | 2985 | ||
| 278 | 반응형웹 | 5년 전 | 2834 | ||
| 277 | 부트스트랩 | 7년 전 | 5033 | ||
| 276 | 부트스트랩 | 7년 전 | 6589 | ||
| 275 | 부트스트랩 | 7년 전 | 4671 | ||
| 274 | 부트스트랩 | 7년 전 | 6700 | ||
| 273 | 부트스트랩 | 7년 전 | 3366 | ||
| 272 | 부트스트랩 | 7년 전 | 3206 | ||
| 271 | 부트스트랩 | 8년 전 | 3707 | ||
| 270 | 부트스트랩 | 8년 전 | 3233 | ||
| 269 | 부트스트랩 | 8년 전 | 3108 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기