Search code examples
imageangularmaster-detail

How to change image source in Angular master/detail interface?


I am trying to build a simple master/detail view in angular(4) with an img in 'detail' component but i couldn't figure out how to change the img src every time i select an element from the master list.

Image links are like this;

"https://example.com/someapi/id.png"


Solution

  • You shuld bind [src] to the image's url, like this:

    <img [src]="imgUrl" [alt]="imgAlt">