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

View: 10844|Reply: 0

[Angular] Angular 9 Series (nine) #id selector applied on the page

[Copy link]
Posted on 2020-6-24 15:47:49 | | | |
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

Angular 9 series (VIII) updates the value of a child component by triggering an event via set
https://www.itsvse.com/thread-9267-1-1.html

requirements, define a value in the html element properties, and use this value multiple times in other tags. For the same value, we want to define the same value only once, rather than defining the same value many times, so that it is easier to maintain.

Element properties are defined in two ways

The first method is our most common way, which can be defined directly in the element tag.

The second way

The renderings are as follows:



The final generated html content:

<p _ngcontent-serverapp-c229="" tag="test" data-message-id="aaa">output: test </p>

Get component attribute values

Angular uses #id on component HTML pages to add an identity to the element and then retrieve it.

We read the tag value of the tag attribute, code:

ts background fetches element properties



Trigger component events

We define an identity for the component through the #id selector, which can also trigger the component's events.

The parent component introduces the child component

Subcomponent methods

The parent component button triggers the child component's onMessage method.

The renderings are as follows:



(End)





Previous:OpenLDAP Series (3) OpenLDAP commands are explained in detail
Next:OpenLDAP custom objectclass and properties
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