<script src="~/angular/runtime*"></script>
<script src="~/angular/polyfills*"></script>
<script src="~/angular/vendor*"></script>
<script src="~/angular/main*"></script>
I want to add these scripts in my Layout page
Static files such as Image files, CSS files and JavaScript JS files does not work in ASP.Net Core unless it is placed in proper location with the project and also some settings are set. In this article I will explain with an example, how to use Static files (Images, CSS and JS files) in ASP.Net Core.
How to include a JavaScript file in another JavaScript file ? In native JavaScript before ES6 Modules 2015 has been introduced had no import, include, or require, functionalities. Before that, we can load a JavaScript file into another JavaScript file using a script tag inside the DOM that script will be downloaded and executed immediately.
These are the ASP.NET programming features introduced in the article: The File object, which provides a way to manage files. The FileUpload helper. The Path object, which provides methods that let you manipulate path and file names. This tutorial also works with WebMatrix 3.
Probably the file is not in the path specified. '../../../' will move 3 step up to the directory in which the page is located and look for the js file in a folder named JS. Also the language attribute is Deprecated. Deprecated. This attribute specifies the scripting language of the contents of this element.
As far as I can tell, the hashes in your js file names are caused by the --prod
flag in the angular-cli.
You basically have to options here:
--prod
flag--output-hashing none
flagThat means you would end up with a build command similar to this:
ng build --prod --output-hashing none
Please note, that the hashes serve a specific purpose: Cache-Busting. Everytime you generate a new build, these hashes change and if you inject the script(s) automatically into a html file using the angular-cli, this has the benefit of not needing to check if you have to clear your cache and if the changes have been picked up by your browser or if they have been served from disk.
Documentation: https://angular.io/cli/build
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With