javascript - Angular 4 index.html won't load any script -


this frustrating, i'm trying load simple script inside index.html 404.

index.html

<head>   <meta charset="utf-8">   <title>login</title>   <base href="/">   <meta name="viewport" content="width=device-width, initial-scale=1">   <link rel="icon" type="image/x-icon" href="favicon.ico"> </head> <body>   <app-root></app-root>   <script type="text/javascript" src="./app/scripts/angular-cookies.js"></script> </body> </html> 

this project structure

enter image description here

this error - 404

enter image description here

the file there , it's not empty. tried also:

<script type="text/javascript" src="../app/scripts/angular-cookies.js"> 

and

<script type="text/javascript" src="app/scripts/angular-cookies.js"> 

and

<script type="text/javascript" src="/app/scripts/angular-cookies.js"> 

any appreciated, thanks!

as i've mentioned in comment, external resource should placed in assets folder , case referenced <script type="text/javascript" src="assets/scripts/angular-cookies.js"> considering assets contains folder named scripts contains angular-cookies.js file. after building code resulted www folder like:

  • assets -> contains external files
  • build -> contains ts files transpiled js files
  • index.html
  • other files

Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -