This article is a mirror article of machine translation, please click here to jump to the original article.

View: 9484|Reply: 1

[Angular] Angular 9 series (VIII) updates the value of a child component by triggering an event via set

[Copy link]
Posted on 6/17/2020 5:46:48 PM | | | |
Angular 9 Series (1) Dynamically Loaded Components
https://www.itsvse.com/thread-9238-1-1.html

Angular 9 series (2) dynamic component transmission parameters
https://www.itsvse.com/thread-9245-1-1.html

Angular 9 series (3) subscribes to dynamic component events
https://www.itsvse.com/thread-9246-1-1.html

Angular 9 Series (IV) Custom Pipe pipelines
https://www.itsvse.com/thread-9248-1-1.html

Angular 9 Series (V) formats the amount currency format
https://www.itsvse.com/thread-9249-1-1.html

Angular 9 series (VI) calls native JS variables and methods
https://www.itsvse.com/thread-9254-1-1.html

Angular 9 series (VII) CSS-style scope
https://www.itsvse.com/thread-9264-1-1.html

In the process of passing values to parent components, you can use EventEmitter to send values to the parent component, and the parent component can manipulate the obtained values in the method.

For the values bound to the child components by the parent component, they are received as variables when they are transmitted, and the set method of @Input() should be used to manipulate and process the incoming values.

First, we click the "Update Child Component Content" button of the parent component to update the content displayed by the child component, and print out the content of each update, the effect is as follows:



Subcomponent child-page.component.html Code:


Subcomponent child-page.component.ts Code:


Parent Component index.component.html Code:


Parent Component index.component.ts Code:

(End)





Previous:More than one module matches. Use skip-import option to skip importing...
Next:Vue+ElementUI implementation
 Landlord| Posted on 5/29/2024 4:13:47 PM |
Angular 17 series (XVII) detects changes in @Input values
https://www.itsvse.com/thread-10775-1-1.html
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com