1. How to pass the value of the parent component to the child component?
Introduce Input in the child component, and then use @Input variable 1 to receive
Then in the parent component, add [msg]="msg" to the child component label, the name in the brackets should be the same as the name after @Input in the child component
Then you can call the passed msg in the child component
Parent component assignment:
Subcomponents use:
2. How to pass values from child components to parent components?
First introduce Output, EvnentEmitter in the subcomponent, then instantiate EvnentEmitter, and finally broadcast
then in the parent component
When the event is fired, you will get the result