In Ionic v5.4.16 with Angular v9 I’d like to load images via ion-img
. Usually one places image files into the source directory src/assets
which ends up in the output directory e.g. www/assets
after building. The angular.json
looks as follows:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
...,
"projects": {
"app": {
"root": "",
"sourceRoot": "src",
...,
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...,
"outputPath": "www",
...,
"assets": [
{
"glob": "**/*",
"input": "src/assets",
"output": "assets"
},
{
"glob": "**/*.svg",
"input": "node_modules/ionicons/dist/ionicons/svg",
"output": "./svg"
}
],
...
I pasted images into www/assets/label_images/apple.png
, etc. and reference with <ion-img> src="/assets/label_images/apple.png"</ion-img>
but it did not work. Have I used the
Is there a way to load images from the webserver instead?