1 개요[ | ]
- AngularJS 튜토리얼 - Hello 예제 6
- 3개의 파일로 구성된 예제
- ng-repeat를 사용한 예제
2 index.html[ | ]
html
Copy
<!doctype html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script>
</head>
<body ng-app="HelloApp7">
<ul ng-controller="HelloController">
<li ng-repeat="friend in friends">
안녕 {{ friend }}!
</li>
</ul>
<!-- Modules -->
<script src="js/app.js"></script>
<!-- Controllers -->
<script src="js/controllers/HelloController.js"></script>
<!-- Services -->
<!-- Directives -->
</body>
</html>
3 js/app.js[ | ]
JavaScript
Copy
var app = angular.module('HelloApp7', []);
4 js/controllers/HelloController.js[ | ]
JavaScript
Copy
app.controller('HelloController', ['$scope', function($scope) {
$scope.friends = ['한놈', '두시기', '석삼'];
}]);
5 테스트[ | ]
6 같이 보기[ | ]
편집자 Jmnote Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.