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

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

问题描述

向 Angular 2.0 迈出第一步.

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

我的 index.html

<头><title>欢迎使用 Angular 2.0</title><!--css--><link rel="stylesheet" type="text/css" href="css/bootstrap.css"/><身体><div class="容器"><h1>你好 Angular 2 </h1><我的应用程序>正在加载应用组件....

<!--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"><脚本>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); });<!--js--></html>

我已经从

但是为了获得具有运行应用程序所需依赖项的 node_modules 文件夹.我需要运行哪些命令.

<块引用>

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

请注意,我是 NPM 的新手.谢谢.

解决方案

npm install 在根项目中(它将从 中提到的依赖项创建您的 node_modules>package.json 文件,应该有 那些文件 作为开始)

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天全站免登陆