Cơ BảnAngular iconAngular

Input và Output trong Angular component dùng để làm gì?

input() hoặc @Input() nhận data từ parent xuống child.

output() hoặc @Output() phát event từ child lên parent. Pattern chuẩn là one-way data flow: parent sở hữu state, child nhận input và emit event khi user tương tác. Tránh để child mutate object input trực tiếp vì dễ tạo side effect khó debug.

Xem toàn bộ Angular cùng filter theo level & chủ đề con.

Mở danh sách Angular