简体   繁体   English

Angular2打字稿的环境问题

[英]Environment issue with Angular2 typescript

Environment issue with Angular2 typescript. Angular2打字稿的环境问题。

I can't get angular2 project to run. 我无法运行angular2项目。 Typescript compiler has no errors. Typescript编译器没有错误。

There's only errors in the browser console. 浏览器控制台中只有错误。

Heres my error console: 这是我的错误控制台:

在此处输入图片说明

Heres my index.html: 这是我的index.html:

在此处输入图片说明

I found the issue. 我发现了问题。

I wasnt point my live-server to the correct location. 我没有将实时服务器指向正确的位置。 Basically, I was too deep so it couldnt reference the node modes. 基本上,我太深了,所以它无法引用节点模式。

This change also had to be made to my index.html: 也必须对我的index.html进行此更改:

 <!DOCTYPE html>
 <html>
   <head>
     <base href="/"></base>
     <title>Angular</title>

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">

     <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">

     <script src="//code.jquery.com/jquery-1.11.3.min.js"></script>

     <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>

     <script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.18.4/system.src.js"></script>    

     <script>
         System.config({
             transpiler: 'typescript',
             defaultJSExtensions: true
         });
     </script>

     <!--<script src="angular2.dev.js"></script>
     <script src="router.dev.js"></script>
     <script src="http.js"></script>
     <script src="firebase/firebase.js"></script>-->  

     <script src="../node_modules/angular2/bundles/angular2.dev.js"></script>
     <script src="../node_modules/angular2/bundles/router.dev.js"></script>
     <script src="../node_modules/angular2/bundles/http.js"></script>
     <script src="/src/firebase/firebaseNew.js"></script>  

   </head>

   <body class="container">
     <app></app>
     <script>
       /*System.import('app/app');*/
       System.import('src/app/app');
     </script>
   </body>
 </html>

I've commented out what used to be in the index.html. 我已经注释掉了index.html中的内容。

I now point my live-server like this using git bash: live-server --entry-file=src/index.html 我现在使用git bash指向这样的活动服务器:live-server --entry-file = src / index.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM