Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to use angular router link on an image to make it as a link to navigate into other component

how to make clickable image that navigate into other components in angular ,
this image is placed in navbar as a small profile picture of the current user.

      <img ngSrc="{{User.photoUrl ||'./assets/images/default.png'}}" alt="user image" height="40" 
       width="40" priority>

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

To use routerlink in an <img>-element, you can wrap it in an <a>-element and apply the router-link to the <a>-element:

<a [routerLink]="['/route']">
   <img ngSrc="{{User.photoUrl ||'./assets/images/default.png'}}" alt="userimage" height="40" width="40" priority>
</a>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading