如何为Angular 2.0设置环境? [英] How to setup the environment for Angular 2.0?

查看:130
本文介绍了如何为Angular 2.0设置环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将我的初步步骤转向Angular 2.0。



首先要为开发设置合适的环境。



我的index.html

 <!DOCTYPE HTML> 
< html>

< head>
< title>欢迎使用Angular 2.0< / title>
<! - css - >
< link rel =stylesheettype =text / csshref =css / bootstrap.css/>
< / head>

< body>
< div class =container>
< h1>你好Angular 2< / h1>
< my-app>正在加载应用组件....< my-app>
< / div>
<! - js - >
<! - 旧浏览器的Polyfills - >
< script src =https://unpkg.com/core-js/client/shim.min.js>< / script>

< script src =https://unpkg.com/zone.js@0.7.4?main=browser>< / script>
< script src =https://unpkg.com/reflect-metadata@0.1.8>< / script>
< script src =https://unpkg.com/systemjs@0.19.39/dist/system.src.js> < /脚本>

< script> window.autoBootstrap = true; < /脚本>

< script src =https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js> < /脚本>
< script>
System.import('app')。catch(function(e){console.log(e);});
< / script>
<! - js - >
< / body>

< / html>

我复制了



但是要获得 node_modules 具有运行应用程序所需依赖项的文件夹。
我需要运行什么命令。


设置Angular 2环境需要运行哪些命令?


请注意我是NPM的新手。
谢谢。

解决方案

根项目中的npm install (它将从 package.json 文件中提到的依赖项创建 node_modules ,应该这些文件作为开头)


Taking my initial steps towards Angular 2.0.

First thing is to set up the right environment for the development.

My index.html

<!DOCTYPE HTML>
<html>

<head>
  <title>Welcome to Angular 2.0</title>
  <!--css-->
  <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
 </head>

 <body>
 <div class="container">
    <h1> Hello Angular 2 </h1>
      <my-app> Loading app component....<my-app>
</div>
<!--js-->
<!-- Polyfills for older browsers -->
<script src="https://unpkg.com/core-js/client/shim.min.js"></script>

<script src="https://unpkg.com/zone.js@0.7.4?main=browser"></script>
<script src="https://unpkg.com/reflect-metadata@0.1.8"></script>
<script src="https://unpkg.com/systemjs@0.19.39/dist/system.src.js">   </script>

<script> window.autoBootstrap = true; </script>

<script src="https://cdn.rawgit.com/angular/angular.io/b3c65a9/public/docs/_examples/_boilerplate/systemjs.config.web.js"></script>
<script>
    System.import('app').catch(function (e) { console.log(e); });
  </script>
  <!--js-->
 </body>

 </html>

I have copied the content from https://angular.io/docs/ts/latest/guide/setup.html for the following files:-

  • app.component.ts
  • app.module.ts
  • main.ts

NPM is installed & running.

But in order to get the node_modules folders with the required dependencies for the app to run. What commands do I need to run.

What are the commands that I need to run to set up the Angular 2 environment?

Please note I am new to NPM. Thanks.

解决方案

npm install in the root project (it will create your node_modules from the dependencies mentioned in package.json file, should have those files as a start)

这篇关于如何为Angular 2.0设置环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆