Reputation: 31
I need to get picture from my Angular project (extrenally)
My pics are in the assets folder app/src/assets/pictures/picture.png
and i want to get them like this "http://monsite.com/data/picture.png"
so app/src/assets/pictures
----> /data/
but with the routing pattenrs, it says /data/
is not a valid route
(This is the goal I want to reach)
[img]http://monsite.com/data/picture.png[/img]
Do you know how can I manage to get this result?
Upvotes: 2
Views: 1179
Reputation: 4117
Create data
folder in src
(src/data
), then add the image picture.png
in the src/data
directory.
Now in order to use data
as assets
folder add the entry in angular.json
assets.
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angulardemo": {
"root": "",
...
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
...
"assets": [
"src/favicon.ico",
"src/assets",
"src/data" <- Add you custom asset folder here
],
Upvotes: 3