내용으로 건너뛰기
GaramX
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
현재 위치:
home
»
angular
»
component-interaction
추적:
angular:component-interaction
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
===== Component Interaction ===== ==== From the parent component To the child component ==== 1.Parent Component <code html> <app-test-component-interaction [parentData]="name"></app-test-component-interaction> </code> 2.Child Component <code javascript> export class TestComponentInteractionComponent implements OnInit { //@Input() public parentData; @Input('parentData') public name; constructor() { } ngOnInit() { } } </code> ==== From the child component To the parent component ==== 1.child component <code html> <h2>Hello {{ name }}</h2> <button (click)="firstEvent()">Send Event</button> </code> <code javascript> export class TestComponentInteractionComponent implements OnInit { @Input('parentData') public name; @Output() public childEvent = new EventEmitter(); constructor() { } ngOnInit() { } firstEvent(){ this.childEvent.emit('Hey Taekgu'); } } </code> 2.parent component <code html> <div>Child message: {{ message }}</div> <app-test-component-interaction (childEvent)="message=$event" [parentData]="name"></app-test-component-interaction> </code>
angular/component-interaction.txt
· 마지막으로 수정됨: 2025/04/15 10:05 저자
127.0.0.1
문서 도구
문서 보기
이전 판
역링크
맨 위로