앵귤러js ng-model ng-init ng-repeat
앵귤러js ng-model ng-init ng-repeat
ng-app : angularjs앱에 시작을 알림
ng-init : 앱 데이터들을 초기설정함
ng-model: 변수 설정
ng-repeat : 데이터 셋에 있는 아이템을 하나씩 보여줌
예제를 보면 정말 어렵지 않습니다.
<html>
<head>
<meta charset="UTF-8">
<title>앵귤러js</title>
</head>
<body>
<div ng-app="" ng-init="menu=[{price:'1000', name:'오징어'}, {price:'6000', name:"김밥"}, {price:'2000', name:'순대'}]">
<p>이름 : <input type="text" ng-model="nm"></p>
<p><span ng-bind="nm"></span>님</p>
<ul>
<li ng-repeat="food in menu">
{{ '메뉴: ' + food.name + ' 가격 : ' + food.price + ' 원'}}
</li>
</ul>
</div>
</body>
</html>
ng-init는 초기 값을 설정하는 것입니다.
예제를 보면 초기에 오징어, 김밥, 순대에 가격을 셋팅을 하죠
ng-model과 ng-bind가 함께 쓰이는 데요.
ng-model에 입력한 값이 ng-bind에 출력되게 됩니다.
이것은 앵귤러js 1일차 강좌에서 확인 하셨을 것입니다.
ng-repeat는 회전을 하면서 값을 한개씩 출력하는 것입니다.
ng-repeat="food in menu"
ng-init="menu .....
menu에 있는 값을 한개씩 food에 넣고
{{ '메뉴: ' + food.name + ' 가격 : ' + food.price + ' 원'}}
이 부분에서 출력하게 됩니다.
ng-app : angularjs앱에 시작을 알림
ng-init : 앱 데이터들을 초기설정함
ng-model: 변수 설정
ng-repeat : 데이터 셋에 있는 아이템을 하나씩 보여줌
예제를 보면 정말 어렵지 않습니다.
<html>
<head>
<meta charset="UTF-8">
<title>앵귤러js</title>
</head>
<body>
<div ng-app="" ng-init="menu=[{price:'1000', name:'오징어'}, {price:'6000', name:"김밥"}, {price:'2000', name:'순대'}]">
<p>이름 : <input type="text" ng-model="nm"></p>
<p><span ng-bind="nm"></span>님</p>
<ul>
<li ng-repeat="food in menu">
{{ '메뉴: ' + food.name + ' 가격 : ' + food.price + ' 원'}}
</li>
</ul>
</div>
</body>
</html>
ng-init는 초기 값을 설정하는 것입니다.
예제를 보면 초기에 오징어, 김밥, 순대에 가격을 셋팅을 하죠
ng-model과 ng-bind가 함께 쓰이는 데요.
ng-model에 입력한 값이 ng-bind에 출력되게 됩니다.
이것은 앵귤러js 1일차 강좌에서 확인 하셨을 것입니다.
ng-repeat는 회전을 하면서 값을 한개씩 출력하는 것입니다.
ng-repeat="food in menu"
ng-init="menu .....
menu에 있는 값을 한개씩 food에 넣고
{{ '메뉴: ' + food.name + ' 가격 : ' + food.price + ' 원'}}
이 부분에서 출력하게 됩니다.
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 58 | jQuery Mobile | 8년 전 | 2978 | ||
| 57 | jQuery Mobile | 8년 전 | 2023 | ||
| 56 | jQuery Mobile | 8년 전 | 1353 | ||
| 55 | jQuery Mobile | 8년 전 | 1546 | ||
| 54 | jQuery Mobile | 8년 전 | 2229 | ||
| 53 | jQuery Mobile | 8년 전 | 1527 | ||
| 52 | jQuery Mobile | 8년 전 | 1549 | ||
| 51 | jQuery Mobile | 8년 전 | 1419 | ||
| 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년 전 | 1466 | ||
| 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년 전 | 2856 | ||
| 32 | AngularJS | 8년 전 | 2426 | ||
| 31 | AngularJS | 8년 전 | 1759 | ||
| 30 | AngularJS | 8년 전 | 2834 | ||
| 29 | AngularJS | 8년 전 | 2386 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기