문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 양쪽 이전 판이전 판다음 판 | 이전 판 | ||
| angular:component-interaction [2019/01/15 02:33] – taekgu | angular:component-interaction [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1 | ||
|---|---|---|---|
| 줄 3: | 줄 3: | ||
| 1.Parent Component | 1.Parent Component | ||
| <code html> | <code html> | ||
| - | | + | < |
| </ | </ | ||
| 2.Child Component | 2.Child Component | ||
| 줄 14: | 줄 14: | ||
| } | } | ||
| } | } | ||
| + | </ | ||
| + | ==== From the child component To the parent component ==== | ||
| + | 1.child component | ||
| + | <code html> | ||
| + | < | ||
| + | <button (click)=" | ||
| + | </ | ||
| + | <code javascript> | ||
| + | export class TestComponentInteractionComponent implements OnInit { | ||
| + | @Input(' | ||
| + | @Output() public childEvent = new EventEmitter(); | ||
| + | |||
| + | constructor() { } | ||
| + | |||
| + | ngOnInit() { | ||
| + | } | ||
| + | firstEvent(){ | ||
| + | this.childEvent.emit(' | ||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | 2.parent component | ||
| + | <code html> | ||
| + | < | ||
| + | < | ||
| </ | </ | ||