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>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 58 | jQuery Mobile | 8년 전 | 2978 | ||
| 57 | jQuery Mobile | 8년 전 | 2024 | ||
| 56 | jQuery Mobile | 8년 전 | 1353 | ||
| 55 | jQuery Mobile | 8년 전 | 1546 | ||
| 54 | jQuery Mobile | 8년 전 | 2230 | ||
| 53 | jQuery Mobile | 8년 전 | 1527 | ||
| 52 | jQuery Mobile | 8년 전 | 1551 | ||
| 51 | jQuery Mobile | 8년 전 | 1420 | ||
| 50 | jQuery Mobile | 8년 전 | 1308 | ||
| 49 | jQuery Mobile | 8년 전 | 1814 | ||
| 48 | jQuery Mobile | 8년 전 | 1458 | ||
| 47 | jQuery Mobile | 8년 전 | 2014 | ||
| 46 | jQuery Mobile | 8년 전 | 1974 | ||
| 45 | jQuery Mobile | 8년 전 | 1509 | ||
| 44 | jQuery Mobile | 8년 전 | 1670 | ||
| 43 | jQuery Mobile | 8년 전 | 1781 | ||
| 42 | jQuery Mobile | 8년 전 | 1659 | ||
| 41 | jQuery Mobile | 8년 전 | 1829 | ||
| 40 | jQuery Mobile | 8년 전 | 1467 | ||
| 39 | jQuery Mobile | 8년 전 | 1627 | ||
| 38 | jQuery Mobile | 8년 전 | 2174 | ||
| 37 | jQuery Mobile | 8년 전 | 2677 | ||
| 36 | jQuery Mobile | 8년 전 | 2126 | ||
| 35 | jQuery Mobile | 8년 전 | 1514 | ||
| 34 | jQuery Mobile | 8년 전 | 2413 | ||
| 33 | AngularJS | 8년 전 | 2858 | ||
| 32 | AngularJS | 8년 전 | 2426 | ||
| 31 | AngularJS | 8년 전 | 1760 | ||
| 30 | AngularJS | 8년 전 | 2836 | ||
| 29 | AngularJS | 8년 전 | 2387 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기