AngularJS Scope 2
AngularJS Scope
범위는 HTML (보기)와 JavaScript (컨트롤러) 간의 바인딩 부분입니다.
범위는 사용 가능한 속성 및 메서드가있는 객체입니다.
범위는 뷰와 컨트롤러 모두에서 사용할 수 있습니다.
범위 이해하기
AngularJS 응용 프로그램을 다음으로 구성한다고 간주 할 경우 :
보기, HTML입니다.
현재보기에 사용할 수있는 데이터 인 모델
Controller : 데이터를 변경 / 제거 / 제어하는 JavaScript 함수입니다.
그런 다음 범위가 모델입니다.
범위는 뷰와 컨트롤러에서 사용할 수있는 속성 및 메서드가있는 JavaScript 객체입니다.
예
뷰를 변경하면 모델과 컨트롤러가 업데이트됩니다.
<div ng-app="myApp" ng-controller="myCtrl">
<input ng-model="name">
<h1>My name is {{name}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name = "John Doe";
});
</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">
<input ng-model="name">
<h1>My name is {{name}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name = "John Doe";
});
</script>
<p>When you change the name in the input field, the changes will affect the model, and it will also affect the name property in the controller.</p>
</body>
</html>
범위는 HTML (보기)와 JavaScript (컨트롤러) 간의 바인딩 부분입니다.
범위는 사용 가능한 속성 및 메서드가있는 객체입니다.
범위는 뷰와 컨트롤러 모두에서 사용할 수 있습니다.
범위 이해하기
AngularJS 응용 프로그램을 다음으로 구성한다고 간주 할 경우 :
보기, HTML입니다.
현재보기에 사용할 수있는 데이터 인 모델
Controller : 데이터를 변경 / 제거 / 제어하는 JavaScript 함수입니다.
그런 다음 범위가 모델입니다.
범위는 뷰와 컨트롤러에서 사용할 수있는 속성 및 메서드가있는 JavaScript 객체입니다.
예
뷰를 변경하면 모델과 컨트롤러가 업데이트됩니다.
<div ng-app="myApp" ng-controller="myCtrl">
<input ng-model="name">
<h1>My name is {{name}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name = "John Doe";
});
</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">
<input ng-model="name">
<h1>My name is {{name}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.name = "John Doe";
});
</script>
<p>When you change the name in the input field, the changes will affect the model, and it will also affect the name property in the controller.</p>
</body>
</html>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 118 | jQuery Mobile | 8년 전 | 1332 | ||
| 117 | jQuery Mobile | 8년 전 | 1582 | ||
| 116 | jQuery Mobile | 8년 전 | 1807 | ||
| 115 | jQuery Mobile | 8년 전 | 1771 | ||
| 114 | jQuery Mobile | 8년 전 | 1956 | ||
| 113 | jQuery Mobile | 8년 전 | 1868 | ||
| 112 | jQuery Mobile | 8년 전 | 2478 | ||
| 111 | jQuery Mobile | 8년 전 | 1779 | ||
| 110 | jQuery Mobile | 8년 전 | 1572 | ||
| 109 | jQuery Mobile | 8년 전 | 1732 | ||
| 108 | jQuery Mobile | 8년 전 | 1957 | ||
| 107 | jQuery Mobile | 8년 전 | 1762 | ||
| 106 | jQuery Mobile | 8년 전 | 1443 | ||
| 105 | jQuery Mobile | 8년 전 | 1736 | ||
| 104 | jQuery Mobile | 8년 전 | 2403 | ||
| 103 | jQuery Mobile | 8년 전 | 1550 | ||
| 102 | jQuery Mobile | 8년 전 | 1494 | ||
| 101 | jQuery Mobile | 8년 전 | 1676 | ||
| 100 | jQuery Mobile | 8년 전 | 1912 | ||
| 99 | jQuery Mobile | 8년 전 | 1364 | ||
| 98 | jQuery Mobile | 8년 전 | 1387 | ||
| 97 | jQuery Mobile | 8년 전 | 1646 | ||
| 96 | jQuery Mobile | 8년 전 | 1301 | ||
| 95 | jQuery Mobile | 8년 전 | 1123 | ||
| 94 | jQuery Mobile | 8년 전 | 1519 | ||
| 93 | jQuery Mobile | 8년 전 | 1141 | ||
| 92 | jQuery Mobile | 8년 전 | 1561 | ||
| 91 | jQuery Mobile | 8년 전 | 1509 | ||
| 90 | jQuery Mobile | 8년 전 | 1677 | ||
| 89 | jQuery Mobile | 8년 전 | 1656 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기