Property Binding

// binding.html
<img [src]="imgSrc">
<img src="{{ imgSrc }}"> // interpolation
<img bind-src="imgSrc">
import { Component } from 'angular2/core';

@Component({
    selector: 'selector',
    templateUrl: 'binding.html'
})
export class ComponentNameComponent{
    src = "https://angular.io/resources/images/logos/angular2/shield-with-beta.png";
}

Last updated

Was this helpful?