Ofure Osezuah
asked on
Angular component selector not working when used as tag in .cshtml view
Hi experts. I'm integrating angular into my aspnet core project. Issue is, I can't seem to render my component(which I used as a tag in my .cshtml view). When i checked my console for the errors, I saw that it came with the runtime, polyfills, style, etc which I used in my <head> element..I removed them all, still didn't render... Is there a basic configuration I'm supposed to do before my angular component selectors can work as tags in my html? Thanks in advance
ASKER
Hi Hansen. It's angular 6. It runs well with ng serve -o, but not with the normal IIS run
Have you done an ng build?
Are you running it from the root folder on IIS or a sub-folder?
If a sub-folder you need to build with the base-href tag
So if your URL is
http://IISServer/angular/myapp/
Then your build command would be
Are you running it from the root folder on IIS or a sub-folder?
If a sub-folder you need to build with the base-href tag
So if your URL is
http://IISServer/angular/myapp/
Then your build command would be
ng build --prod --base-href /angular/myapp/
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Assuming 1.x Have you included the ng-app tag in your document?'
Have you included the link to the AngularJS Library?