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

html - How to set bootstrap input responsive width? -

javascript - Highchart x and y axes data from json -

javascript - Get js console.log as python variable in QWebView pyqt -