mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
docs(docs-infra): signal property should be readonly (#63166)
PR Close #63166
This commit is contained in:
parent
01bbafd47e
commit
e63608d4d2
1 changed files with 2 additions and 1 deletions
|
|
@ -189,7 +189,7 @@ export class UserProfile {
|
|||
}
|
||||
```
|
||||
|
||||
### Use `readonly` on properties that are initialized by Angular
|
||||
### Use `readonly` for properties that shouldn't change
|
||||
|
||||
Mark component and directive properties initialized by Angular as `readonly`. This includes
|
||||
properties initialized by `input`, `model`, `output`, and queries. The readonly access modifier
|
||||
|
|
@ -200,6 +200,7 @@ ensures that the value set by Angular is not overwritten.
|
|||
export class UserProfile {
|
||||
readonly userId = input();
|
||||
readonly userSaved = output();
|
||||
readonly userName = model();
|
||||
}
|
||||
```
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue