앵귤러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 + ' 원'}}
이 부분에서 출력하게 됩니다.
게시판 목록
퍼블리싱강좌
| 번호 | 분류 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|---|
| 118 | jQuery Mobile | 8년 전 | 1352 | ||
| 117 | jQuery Mobile | 8년 전 | 1603 | ||
| 116 | jQuery Mobile | 8년 전 | 1834 | ||
| 115 | jQuery Mobile | 8년 전 | 1787 | ||
| 114 | jQuery Mobile | 8년 전 | 1976 | ||
| 113 | jQuery Mobile | 8년 전 | 1884 | ||
| 112 | jQuery Mobile | 8년 전 | 2492 | ||
| 111 | jQuery Mobile | 8년 전 | 1795 | ||
| 110 | jQuery Mobile | 8년 전 | 1589 | ||
| 109 | jQuery Mobile | 8년 전 | 1750 | ||
| 108 | jQuery Mobile | 8년 전 | 1974 | ||
| 107 | jQuery Mobile | 8년 전 | 1777 | ||
| 106 | jQuery Mobile | 8년 전 | 1456 | ||
| 105 | jQuery Mobile | 8년 전 | 1759 | ||
| 104 | jQuery Mobile | 8년 전 | 2440 | ||
| 103 | jQuery Mobile | 8년 전 | 1571 | ||
| 102 | jQuery Mobile | 8년 전 | 1514 | ||
| 101 | jQuery Mobile | 8년 전 | 1701 | ||
| 100 | jQuery Mobile | 8년 전 | 1931 | ||
| 99 | jQuery Mobile | 8년 전 | 1389 | ||
| 98 | jQuery Mobile | 8년 전 | 1411 | ||
| 97 | jQuery Mobile | 8년 전 | 1665 | ||
| 96 | jQuery Mobile | 8년 전 | 1316 | ||
| 95 | jQuery Mobile | 8년 전 | 1130 | ||
| 94 | jQuery Mobile | 8년 전 | 1534 | ||
| 93 | jQuery Mobile | 8년 전 | 1151 | ||
| 92 | jQuery Mobile | 8년 전 | 1574 | ||
| 91 | jQuery Mobile | 8년 전 | 1526 | ||
| 90 | jQuery Mobile | 8년 전 | 1691 | ||
| 89 | jQuery Mobile | 8년 전 | 1672 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기