DATA BINDING : Angular data binding types

yotube
0

 TYPE

    1 Interpolation : You met the double-curly braces of interpolation, {{ and }}, early in your Angular education.


    2 Property binding : from a component to an element.

    lets you interpolate values that are computed from your application data into the HTML.

                         <videoItem [items]="items"></videoItem>

                         <img [src]="heroImageUrl">



    3 Event binding    : from an element to a component.

    lets your app respond to user input in the target environment by updating your application data.

                         <li (click)="go()"></li>



    4 Attribute binding :

        You can set the value of an attribute directly with an attribute binding.

        <tr><td [attr.colspan]="1 + 1">One-Two</td></tr>



    5 Class binding

        You can add and remove CSS class names from an element's class attribute with a class binding.

        [class]="badCurly"

        [class.special]="isSpecial"



    6 Style binding

        You can set inline styles with a style binding.

        [style.color]="isSpecial ? 'red': 'green'"



    7 Two-way data binding

            Two-way data binding: combines property and event binding in a single notation.

                          <input [(ngModel)]="name">

                          <input [ngModel]="currentHero.name"  (ngModelChange)="setUppercaseName($event)">




Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
To Top