I have following template
<div id="collage" class="collage">
<img *ngIf="photos" *ngFor="#photo of photos" src="photo.getUrl()" [width]="photo.width" [height]="photo.height">
</div>
The photos
is coming as input to the template. The function photo.getUrl()
just returns a string with some image url. The CollageComponent
looks like:
import {Component, OnChanges, Input} from 'angular2/core';
import {Photo} from 'interfaces/photo';
@Component({
selector: 'collage',
templateUrl: 'templates/collage.html'
})
export class CollageComponent implements OnChanges {
@Input() photos: Photo[];
ngOnChanges(change) {
if ('photos' in change && change.photos.currentValue) {
jQuery('#album-collage').collagePlus({
'fadeSpeed': 2000,
'targetHeight': 200
});
}
}
}
But in src
the value that (obviously) coming is the string literal "photo.getUrl()"
. What should be done here so that the image's src
gets assigned the value returned by the function getUrl()
.