parent
c8b5b81516
commit
c9df9afddd
|
@ -144,6 +144,23 @@ For example, "convert_link_mode".
|
|||
* UPPER_UNDERSCORE_CASE (or UPPER_SNAKE_CASE, or SCREAMING_SNAKE_CASE): Traditional for constants (acceptable, but prefer camelCase).
|
||||
Upper snake case uses words in all capital letters connected with underscores. For example, "FIX_ME".
|
||||
|
||||
{@a change-detection}
|
||||
|
||||
## change detection
|
||||
|
||||
The mechanism by which the Angular framework synchronizes the state of an application's UI with the state of the data.
|
||||
The change detector checks the current state of the data model whenever it runs, and maintains it as the previous state to compare on the next iteration.
|
||||
|
||||
As the application logic updates component data, values that are bound to DOM properties in the view can change.
|
||||
The change detector is responsible for updating the view to reflect the current data model.
|
||||
Similarly, the user can interact with the UI, causing events that change the state of the data model.
|
||||
These events can trigger change detection.
|
||||
|
||||
Using the default ("CheckAlways") change-detection strategy, the change detector goes through the [view hierarchy](#view-tree) on each VM turn to check every [data-bound property](#data-binding) in the template. In the first phase, it compares the current state of the dependent data with the previous state, and collects changes.
|
||||
In the second phase, it updates the page DOM to reflect any new data values.
|
||||
|
||||
If you set the `OnPush` ("CheckOnce") change-detection strategy, the change detector runs only when [explicitly invoked] (api/core/ChangeDetectorRef), or when it is triggered by an `Input` reference change or event handler. This typically improves performance. For more information, see [Optimize Angular's change detection](https://web.dev/faster-angular-change-detection/).
|
||||
|
||||
{@a class-decorator}
|
||||
|
||||
## class decorator
|
||||
|
@ -938,7 +955,7 @@ View hierarchies can be loaded and unloaded dynamically as the user navigates th
|
|||
|
||||
## view hierarchy
|
||||
|
||||
A tree of related views that can be acted on as a unit. The root view is a component's *host view*. A host view can be the root of a tree of *embedded views*, collected in a *view container* (`ViewContainerRef`) attached to an anchor element in the hosting component. The view hierarchy is a key part of Angular change detection.
|
||||
A tree of related views that can be acted on as a unit. The root view is a component's *host view*. A host view can be the root of a tree of *embedded views*, collected in a *view container* (`ViewContainerRef`) attached to an anchor element in the hosting component. The view hierarchy is a key part of Angular [change detection](#change-detection).
|
||||
|
||||
The view hierarchy doesn't imply a component hierarchy. Views that are embedded in the context of a particular hierarchy can be host views of other components. Those components can be in the same NgModule as the hosting component, or belong to other NgModules.
|
||||
|
||||
|
|
Loading…
Reference in New Issue