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>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 88 | jQuery Mobile | 8년 전 | 1929 | ||
| 87 | jQuery Mobile | 8년 전 | 1910 | ||
| 86 | jQuery Mobile | 8년 전 | 1517 | ||
| 85 | jQuery Mobile | 8년 전 | 1827 | ||
| 84 | jQuery Mobile | 8년 전 | 1863 | ||
| 83 | jQuery Mobile | 8년 전 | 1878 | ||
| 82 | jQuery Mobile | 8년 전 | 1650 | ||
| 81 | jQuery Mobile | 8년 전 | 1370 | ||
| 80 | jQuery Mobile | 8년 전 | 1805 | ||
| 79 | jQuery Mobile | 8년 전 | 1355 | ||
| 78 | jQuery Mobile | 8년 전 | 1752 | ||
| 77 | jQuery Mobile | 8년 전 | 1777 | ||
| 76 | jQuery Mobile | 8년 전 | 1787 | ||
| 75 | jQuery Mobile | 8년 전 | 1399 | ||
| 74 | jQuery Mobile | 8년 전 | 1537 | ||
| 73 | jQuery Mobile | 8년 전 | 1245 | ||
| 72 | jQuery Mobile | 8년 전 | 1627 | ||
| 71 | jQuery Mobile | 8년 전 | 1620 | ||
| 70 | jQuery Mobile | 8년 전 | 1501 | ||
| 69 | jQuery Mobile | 8년 전 | 1509 | ||
| 68 | jQuery Mobile | 8년 전 | 2045 | ||
| 67 | jQuery Mobile | 8년 전 | 1314 | ||
| 66 | jQuery Mobile | 8년 전 | 1691 | ||
| 65 | jQuery Mobile | 8년 전 | 1183 | ||
| 64 | jQuery Mobile | 8년 전 | 1466 | ||
| 63 | jQuery Mobile | 8년 전 | 1654 | ||
| 62 | jQuery Mobile | 8년 전 | 1632 | ||
| 61 | jQuery Mobile | 8년 전 | 1874 | ||
| 60 | jQuery Mobile | 8년 전 | 1405 | ||
| 59 | jQuery Mobile | 8년 전 | 1962 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기