Contents tagged with Data binding

  • Angular 2 data binding and pipes

    Hello everybody,

    today  I want to make short note about types of Data Binding in AngularJS 2.

    here they are:

    Interpolation. It looks like this in code: {{firstName}}

    Property binding. Sample in code: <img [src]='person.photo'>

    Event binding. Html code pattern: <button (click)='showMessage()'... />

    Two-way binding: <input [(ngModel)]='someProperty' />

    Important think to remember about usage of ngModel is the following:

    in your imports add importing of FormsModule.

    For example like this:

    @NgModule({

           imports: [

              BrowserModule,

              FormsModule]

           declarations: [

              AppComponent,

    .......

           ]

       })

    export class AppModule {

    }

    If … more