dynamic image name in ANGULAR4


In assets folder, I already have images, but name will come from backend

name like foo

we have variable in component, say public imageName and foo will bind to this varialbe dynamically.

So in html i want to display this image I tried below code

<img [src]="/assets/{{imageName}}'.jpg'" class="img-thumbnail" alt="{{imageName}}" width="304" height="236">

but i m unabel to see the image, i am getting some html errors


Try this syntax:

<img [src]="'assets/'+imageName+'.jpg'" class="img-thumbnail" alt="{{imageName}}" width="304" height="236">


  • Google cloud: insufficient authentication scopes
  • getting base64 content string of an image from a mimepart in Java
  • Change UISearchBar background image in iOS11
  • CSS background-image won't show with short URL
  • Adding padding and border to an UIImageView
  • Relative paths. baseUrl and paths not working on ionic2 - angular2
  • Getting unread count in Sent Folder using Google Apps Script - GMail
  • Knockout custom binding handler
  • How to retrieve information from antrun back to maven?
  • How to install node-mysql?
  • Best way to dynamically load an xml configuration file into a Flex4/Flash movie at runtime?
  • Android Studio Can't Find tools.jar
  • msbuild create itemgroup from property group
  • How do I include a SWC in an AS2 Flash project?
  • cygwin cannot exec 'git-add--interactive' permission denied
  • Meteor helpers not available in Angular template
  • How to use an array of arrays with array_map(…) in PHP?
  • Change Inet root folder for iis 7
  • Syntax for setting draggablecursor property in google maps api
  • Paperclip, set path outside of rails root folder
  • Initializer list vs. initialization method
  • Nant, Vault & Windows Integrated Authentication
  • jQuery show() function is not executed in Safari if submit handler returns true
  • Build own AppleScript numerical error handling
  • To display the title for the current loaction in map in iphone
  • GridView Sorting works once only
  • Traverse Array and Display in markup
  • How to get icons for entities from eclipse?
  • Proper folder structure for lots of source files
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • How to set the response of a form post action to a iframe source?
  • How to get Windows thread pool to call class member function?
  • unknown Exception android
  • Append folder name and increment by 1 using batch script
  • JaxB to read class hierarchy
  • Is there any way to bind data to data.frame by some index?
  • failed to connect to specific WiFi in android programmatically
  • java string with new operator and a literal
  • How can I use threading to 'tick' a timer to be accessed by other threads?