Loading [MathJax]/jax/output/HTML-CSS/fonts/TeX/fontdata.js

Angular 2 Template Syntax

Beschreibung

Angular 2 Template Syntax Mind Map
Nick Codes
Mindmap von Nick Codes, aktualisiert more than 1 year ago
Nick Codes
Erstellt von Nick Codes vor fast 9 Jahre
78
4
1 2 3 4 5 (1)

Zusammenfassung der Ressource

Angular 2 Template Syntax
  1. Expressions
    1. Can be within {{ x + x }}
      1. Can be within [property]="x + x"
        1. Context
          1. Only has access to items in the current context (not global scope)
          2. Guidelines
            1. No Visible Side Effects, Shouldn't Change Application State
              1. Keep them as SIMPLE as possible
                1. Most Template Expressions Get Run After Almost Every Event
                2. Make Expressions "Idempotent"
                  1. Should always return the same thing until one of it's dependent values changes
              2. Statements
                1. Responds to user events raised by a binding target
                  1. Alters Application State
                    1. Context
                      1. Only Access to Current Context
                      2. Guidelines
                        1. Keep as Simple as Possible, simple method call or property assignment
                      3. Binding Syntax
                        1. One Way, Data Source -> View
                          1. {{expression}}, [input or property]
                          2. Two Way
                            1. [(property)]
                            2. One Way, View -> Data Source
                              1. (event)
                            3. REMINDER
                              1. Template binding works with properties and events, NOT attributes.
                                1. hero="Nick" & [hero]="Nick"
                                  1. One gets rendered as a string while the other gets rendered as expression
                                2. Binding Targets
                                  1. [ngClass]
                                    1. [class.isSpecial]
                                      1. [attr.attribute]
                                        1. (event)
                                          1. [src]
                                            1. [style.color]
                                            2. Custom Events
                                              1. (lookedAt)="handleEvent($event)"
                                                1. $event object handles the payload
                                                  1. Payload is given by EventEmitter.emit on Component Level
                                              2. Built in Directives
                                                1. *ngIf="expression"
                                                  1. *ngFor="let x of xes"
                                                    1. *ngFor="let object of objects; trackBy:expression"
                                                      1. expression(index: number, hero: Hero) {return hero.id}
                                                        1. Eliminates unnecessary DOM updates for unchanged Objects
                                                        2. * is Syntactic Sugar
                                                          1. Shows that it changes HTML
                                                        3. Pipes
                                                          1. {{name | pipe}}
                                                            1. Incredibly useful for formatting
                                                              1. Can take arguments
                                                                1. {{name | pipe:''long"}}
                                                              2. Safe Navigation Operator
                                                                1. Protect against null values when rendering components
                                                                  1. {{game?.points?.name}}
                                                                    1. Stops rendering the component if one or more values isnt found
                                                                      1. Better than error
                                                                Zusammenfassung anzeigen Zusammenfassung ausblenden

                                                                0 Kommentare

                                                                There are no comments, be the first and leave one below:

                                                                ähnlicher Inhalt

                                                                La commande - Phrases - Chapitre 4
                                                                Gaelle Bourgeois
                                                                Spanisch Einstufungstest Niveau A1.1
                                                                SprachschuleAktiv
                                                                Stochastik
                                                                barbara91
                                                                Projektmanagement
                                                                zok42.com
                                                                Englisch Lernwortschatz A1-C1 Teil 1
                                                                Chiara Braun
                                                                Sops EURO-FH B.Sc.
                                                                ??? ???
                                                                Vetie - Histo & Embryo P 2014
                                                                Fioras Hu
                                                                Bevölkerungssoziologie
                                                                Max H
                                                                Vetie - Arzneimittelverordnung 2014
                                                                Peter Christian Ponn
                                                                Vetie Geflügelkrankheiten Fragebogen 3
                                                                Annika G