Two-way binding documentation is missing important information

Aperta Adatta ai principianti
#71,796 2 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #71797 di @lazerg — chiusa senza merge
  • #71835 di @manjitks — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
75/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
angular, typescript
Ambito
documentation

Direzione di ricerca

Inizia da guide/templates/two-way-binding e consulta la guida collegata sugli input di model e la documentazione dell’API model per gli esempi attuali. Aggiorna la guida sul binding bidirezionale con un breve esempio che mostri sia banana-in-a-box sia la coppia input/output, e spiega che le modifiche del genitore non attivano immediatamente l’evento di modifica del figlio. Il lavoro è completato quando il comportamento chiave è chiaro in un unico punto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

area: docs
Describe the problem that you experienced

When it comes to two-way binding (using the model signal), arguably the most important piece of information is that a value = model<string>(); declared in a child component can be used in the parent's template as either:

  1. Banana-in-a-box: [(value)]="someValue"
  2. A pair of input and output: [value]="someValue" (valueChange)="onSomeValueChanged($event)"

And in the second case, we can additionally assume that whenever someValue changes in the parent component, and gets passed to child, onSomeValueChanged() will not immediately be called back on the parent component - which is critical for the "Data Down, Actions Up (DDAU)" / "unidirectional data flow" principle.


Unfortunately, learning this from the Angular documentation at https://angular.dev/ is not easy. The following links contain just small pieces of this puzzle:

And even putting them all together doesn't fully convey the message described above.

Can we please update the documentation to describe the message from the top of this ticket, in a single place, in a brief way, with a good, illustrative example? (preferably instead of some of the existing content, which is rather unhelpful)

Enter the URL of the topic with the problem

https://angular.dev/guide/templates/two-way-binding

Describe what you were looking for in the documentation

I was trying to teach a colleague how to use a two-way binding, and was looking for good documentation.

Describe the actions that led you to experience the problem

No response

Describe what you want to experience that would fix the problem

No response

Add a screenshot if that helps illustrate the problem

No response

If this problem caused an exception or error, please paste it here

If the problem is browser-specific, please specify the device, OS, browser, and version

Provide any additional information here in as much as detail as you can

Lingua principale
TypeScript
Stelle
102k
Fork
28.2k
Merge medio
2g 10m
PR unite (30g)
402

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di angular/angular

Tutte le issue di angular/angular

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.