javascript - .replace in AngularJs 2 -


in angularjs do;

<img ng-src="https://someimageurl/{{ foo.replace('bar','') }} /> 

how can achieve same result in dom angularjs 2?

this

<img ng-src="https://someimageurl/{{ foo.replace('bar','') }} /> 

is not angular replace method, javascript replace method being called inside angular interpolation.

in angular2, can same doing:

<img [src]="'https://someimageurl/' + foo.replace('bar','')"/> 

you can find more information template syntax in angular 2 docs.


Comments