Reputation: 284
In AngularJS I could do:
<img ng-src="https://someimageurl/{{ foo.replace('bar','') }}" />
How can I achieve the same result in DOM with AngularJS 2?
Upvotes: 1
Views: 796
Reputation: 44659
This
<img ng-src="https://someimageurl/{{ foo.replace('bar','') }} />
is not an angular replace method, is just the javascript replace method being called inside angular interpolation.
In angular2, you can do the same by doing:
<img [src]="'https://someimageurl/' + foo.replace('bar','')"/>
You can find more information about Template Syntax in Angular 2 docs.
Upvotes: 2
Reputation: 68655
Like this:
<img [src]="'https://someimageurl/' + foo.replace('bar','')" />
Upvotes: 1