When compiling for Angularjs4, the page stays in "Loading ..." with "ng build --prod"

1

I'm learning Angularjs4, while I'm trying code everything is fine, that is, executing

  

ng serve

The problem arises when I try to compile the project for production, the sentence that I execute is the following

  

ng build --prod

I understand that this sentence must produce the compiled code of angular in the "dist" folder of the project, and in effect the folder is created and filled with different files, among which is an index.html, but when I enter that folder through localhost, the screen keeps the message

  

Loading ...

It seems that the code is not linking to the framework.

    
asked by Ricardo Gabriel 01.08.2017 в 07:21
source

1 answer

1

I solved the problem by adding "./" at the start of each of the routes generated in the "index.html" file of the "dist" folder after executing the command

  

ng build --prod

Here I leave the file "index.html" already modified, I repeat, just put "./" at the beginning of each route

<head>
  <meta charset="utf-8">
  <title>NuevoProyecto</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>Loading...</app-root>
   <script type="text/javascript" src="./inline.bundle.js">
   </script><script type="text/javascript" src="./polyfills.bundle.js">
   </script><script type="text/javascript" src="./styles.bundle.js">
   </script><script type="text/javascript" src="./vendor.bundle.js">
   </script><script type="text/javascript" src="./main.bundle.js"></script>
   </body>
</html>
    
answered by 01.08.2017 / 19:17
source