Tag: componentinteraction
-
How to communicate between Angular components using @ViewChild annotation
In the previous post I showed how to communicate between two angular components using local template reference. The drawback using that strategy is that you can’t reference the child component inside parent component’s typescript code. It can be referenced only inside the parent template. This can be overcome by using @ViewChild annotation. This will inject…
-
How to communicate between two components in Angular through template reference?
Angular allows component interaction in five ways: Through @Input annotation , a parent component can pass its values to a child component Through @Output annotation , a child component can pass its values and event to a parent component Through services, a child component can subscribe to events of the parent. Through template reference ,…
-
How do components communicate in Angular and how to use @Input and @Output annotations?
There are five ways through which angular components can communicate with each other : Through @Input annotation Through @Output annotation Using local template reference. Using services Using @ViewChild annotation Lets look at @Input and @Output annotation use cases in this post. @Input annotation Say in one component you have a list of items. You create…