当安装在另一个Angular 14应用程序中时,自定义Angular Library Npm无法正常工作

eqqqjvef  于 2022-12-13  发布在  Angular
关注(0)|答案(1)|浏览(170)

I created an Angualr Library npm package and published it to a private Azure Devops Npm feed. I then installed the npm package to an Angualr test project i created.
The package i created will just be used as a component that will be used to take care of the header and footer. But for now all i did was make a simple navbar so i could publish the npm and download and import into an angualr application and see if that navbar displays when i use the selector element tag for that pckg component and its not working.
Two projects involved

  1. Npm Angualr library: "HeaderFooter"
  2. Application : my-first-project
  • project 1 "HeaderFooter" i just made a simple paragraph tag with some text in the template of the component. I built the library. Connected to the feed then published.

  • project 2 "my-first-project" i installed the npm package and imported the package from my node modules in the app.module.ts I then added the component selector of the pkg to my app.component.html

However when i serve my application i am not seeing any of the html from my HeaderFooterLibrary

I have tried two things with the npm package i have tried with template html in the headerfooter package and tried using template url with an actual html file to that component.
I noticed a weird console error that only shows when i have the selector showing in the app.component.html. if i comment it out error goes away.

iyfamqjs

iyfamqjs1#

So I figured out the issue.
The angular library to the Azure Npm feed i was accidently publishing the not built library. Once i figured that it resolved my issue.

相关问题