AngularJS 코드 포함
AngularJS 코드 포함
ng-include 지시어에 포함 된 HTML 파일에는 AngularJS 코드도 포함될 수 있습니다.
myTable.htm :
<table>
<tr ng-repeat="x in names">
<td>{{ x.Name }}</td>
<td>{{ x.Country }}</td>
</tr>
</table>
웹 페이지에 "myTable.htm"파일을 포함하면 포함 된 파일 안의 코드도 포함하여 모든 AngularJS 코드가 실행됩니다.
예
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<div ng-include="'myTable.htm'"></div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers.php").then(function (response) {
$scope.names = response.data.records;
});
});
</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="customersCtrl">
<div ng-include="'myTable.htm'"></div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers.php").then(function (response) {
$scope.names = response.data.records;
});
});
</script>
<p>The HTML, and AngularJS code, for this table are located in the file "myTable.htm".</p>
</body>
</html>
ng-include 지시어에 포함 된 HTML 파일에는 AngularJS 코드도 포함될 수 있습니다.
myTable.htm :
<table>
<tr ng-repeat="x in names">
<td>{{ x.Name }}</td>
<td>{{ x.Country }}</td>
</tr>
</table>
웹 페이지에 "myTable.htm"파일을 포함하면 포함 된 파일 안의 코드도 포함하여 모든 AngularJS 코드가 실행됩니다.
예
<body>
<div ng-app="myApp" ng-controller="customersCtrl">
<div ng-include="'myTable.htm'"></div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers.php").then(function (response) {
$scope.names = response.data.records;
});
});
</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="customersCtrl">
<div ng-include="'myTable.htm'"></div>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("customers.php").then(function (response) {
$scope.names = response.data.records;
});
});
</script>
<p>The HTML, and AngularJS code, for this table are located in the file "myTable.htm".</p>
</body>
</html>
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 178 | AngularJS | 8년 전 | 1434 | ||
| 177 | AngularJS | 8년 전 | 1206 | ||
| 176 | AngularJS | 8년 전 | 1275 | ||
| 175 | AngularJS | 8년 전 | 1371 | ||
| 174 | AngularJS | 8년 전 | 1143 | ||
| 173 | AngularJS | 8년 전 | 1887 | ||
| 172 | AngularJS | 8년 전 | 1440 | ||
| 171 | AngularJS | 8년 전 | 1131 | ||
| 170 | AngularJS | 8년 전 | 1395 | ||
| 169 | AngularJS | 8년 전 | 1191 | ||
| 168 | AngularJS | 8년 전 | 1006 | ||
| 167 | AngularJS | 8년 전 | 1970 | ||
| 166 | AngularJS | 8년 전 | 1043 | ||
| 165 | AngularJS | 8년 전 | 1111 | ||
| 164 | AngularJS | 8년 전 | 1312 | ||
| 163 | AngularJS | 8년 전 | 1157 | ||
| 162 | AngularJS | 8년 전 | 1373 | ||
| 161 | AngularJS | 8년 전 | 1380 | ||
| 160 | AngularJS | 8년 전 | 1134 | ||
| 159 | AngularJS | 8년 전 | 1096 | ||
| 158 | AngularJS | 8년 전 | 1514 | ||
| 157 | AngularJS | 8년 전 | 1482 | ||
| 156 | AngularJS | 8년 전 | 1327 | ||
| 155 | AngularJS | 8년 전 | 1217 | ||
| 154 | AngularJS | 8년 전 | 1623 | ||
| 153 | AngularJS | 8년 전 | 1112 | ||
| 152 | AngularJS | 8년 전 | 1533 | ||
| 151 | AngularJS | 8년 전 | 1427 | ||
| 150 | AngularJS | 8년 전 | 1125 | ||
| 149 | AngularJS | 8년 전 | 1648 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기