How do I import svg from file to a component in angular 5?
If you have logo.svg
:
- Put it inside your
src/assets
folder - Include folder in the
angular.json
config:"assets": [ "src/assets" ]
- Refer to it from template:
<img src="assets/svg/logo.svg">
Include your SVG files in src/assets folder and add the svg folder in your angular.json
file.
"assets": [ "src/assets/svg/*" ]
This way you can include the file in your components as you wish.