I have a couple custom libraries that I load dynamically at runtime based on configuration. I can use assets in an angular application, however this does not work in my library.
Dependency in my package.json
{
...
"dependencies": {
"custom-plugin": "1.0"
}
...
}
That library is installed and available in my node_modules directory:
node_modules
-- custom-plugin
-- lib (angular module/components here)
-- assets
-- image.png
I would like to reference image.png in an html template. I have tried to reference this in an html template in my component as well as outside with no luck.
HTML template, none of these work
<img src="@node_modules/custom-plugin/assets/image.png" />
<img src="assets/image.png" />
<img src="/assets/image.png" />
<img src="src/assets/image.png" />
EDIT: Running Angular 9
Tried adding "assets" property to angular.json.
"projects": {
"mylib": {
"projectType": "library",
"architect": {
"build": {
"builder": "@angular-devkit/build-ng-packagr:build",
"options": {
"tsConfig": "admin/tsconfig.lib.json",
"project": "admin/ng-package.json",
"assets": ["src/assets"]
},
However when building I get the following error:
Schema validation failed with the following errors: Data path "" should NOT have additional properties(assets)
