문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| angular:component [2020/06/10 13:53] – 바깥 편집 127.0.0.1 | angular:component [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 1: | 줄 1: | ||
| ====== Component ====== | ====== Component ====== | ||
| Angular에서 UI를 표현하기 위해서 사용한다. | Angular에서 UI를 표현하기 위해서 사용한다. | ||
| + | * [[angular: | ||
| - | === angular CLI === | + | ===== angular CLI ===== |
| <wrap hi> ng generate **component** < | <wrap hi> ng generate **component** < | ||
| ng g **component** < | ng g **component** < | ||
| + | ng g **c** < | ||
| </ | </ | ||
| + | [[https:// | ||
| ===== Component Annotation ===== | ===== Component Annotation ===== | ||
| Angular에게 Component를 알려주는 Annotation은 @Component라는 Annotation을 사용한다. | Angular에게 Component를 알려주는 Annotation은 @Component라는 Annotation을 사용한다. | ||
| 줄 12: | 줄 14: | ||
| <code javascript> | <code javascript> | ||
| import { Component, OnInit } from ' | import { Component, OnInit } from ' | ||
| + | import { AboutComponent } from ' | ||
| + | |||
| @Component({ | @Component({ | ||
| selector: ' | selector: ' | ||
| - | templateUrl: | + | templateUrl: |
| styleUrl: [' | styleUrl: [' | ||
| }) | }) | ||
| 줄 25: | 줄 29: | ||
| ===== selector ===== | ===== selector ===== | ||
| 3가지 유형을 가진다. | 3가지 유형을 가진다. | ||
| - | == Type 1. ' | + | === Type 1. ' |
| Template html에서 customer tag로써 표현 | Template html에서 customer tag로써 표현 | ||
| <code html> | <code html> | ||
| < | < | ||
| </ | </ | ||
| - | == Type 2. ' | + | === Type 2. ' |
| Template html에서 class로 표현 | Template html에서 class로 표현 | ||
| <code html> | <code html> | ||
| <div class=" | <div class=" | ||
| </ | </ | ||
| - | == Type 3. ' | + | === Type 3. ' |
| Template html에서 Property로 표현 | Template html에서 Property로 표현 | ||
| <code html> | <code html> | ||