Sunday, 30 June 2019

Using angular inside Aspx page

Scenario: Use an angular app inside an aspx page.

Issue: Aspx page has some scripts placed in an asset folder in one place, and angular's code is placed inside "Areas/Navigation/www". When I build the code using ng build --prod --base-href Areas/Navigation/View/www/, it generates the single index file.

I used all the js file reference in my aspx page

<script language="javascript" type="text/javascript" src="Areas/Navigation/View/www/runtime.js"></script>
<script language="javascript" type="text/javascript" src="Areas/Navigation/View/www/es2015-polyfills.js" nomodule></script>
<script language="javascript" type="text/javascript" src="Areas/Navigation/View/www/polyfills.js"></script>
<script language="javascript" type="text/javascript" src="Areas/Navigation/View/www/styles.js"></script>
<script language="javascript" type="text/javascript" src="Areas/Navigation/View/www/vendor.js"></script>
<script language="javascript" type="text/javascript" src="Areas/Navigation/View/www/main.js"></script>
<base href="Areas/Navigation/View/www/" />
....
<app-navigation></app-navigation>

But when i run the application, It's expecting my aspx js/css files to be inside Areas/Navigation/View/www/. How can I solve his?

Update #1:

I tried using ng build, the angular app is rendered in the aspx project but the fonts and transalation file is not loaded.

enter image description here

Actually the en-US.json and the fonts resides in https://localhost:44301/Areas/Navigation/View/www

Update #2:

The fonts are actually from an node package. Its not my font but a third party node package which uses these fonts.



from Using angular inside Aspx page

No comments:

Post a Comment