Mastering Development

angular way to change image src?

<div class="float-right">

  <span class="language dashboard" data-toggle="dropdown">
    <img class="current" src="us-flag.png" />

  <div class="dropdown dashboard">
    <a href="javascript:" (click)="setch('en');" class="dropdown-item">
      <img src="us-flag.png" alt="" />english </a
    <a href="javascript:" (click)="setch('it');" class="dropdown-item">
      <img src="it-flag.png" alt="" />italian </a


this the jquery way:

    'click': function(){
    //do other thing

am using angular 6
looking to write it in angular way without using jquery, however not familiar with it..

looking to load the logic at

  ngOnInit() {

     //assign from default database language setting
     var dbflag = "it";
     //assign $('.current').attr('src','it-flag.png');


    //change flag class="current"

any idea guys, for writing it in angular ts way?

Leave a Reply

Your email address will not be published. Required fields are marked *