AngularJS学习之二:配置本地开发环境
安装Angular QuickStart seed,以便在您的机器上更快,更高效地开发设置一个本地开发环境这个QuickStart live-coding例子是一个操场。它并不是你将要开发一个真正应用的地方。你应该在你的机器上本地化开发...... 这也是我们所认为的你应该如何去学习Angular的方法。 在你的机器上,使用这个QuickStart seed建立一个新的项目是快和容易的,QuickStart seed被维护在github上。 这个QuickStart seed live-example是 QuickStart加上app.module.ts和main.ts应用文件(下面有描述),这两个文件有利于更丰富的应用例子展示。 确保你已经安装了node和 npm 。然后 ...
克隆
使用下面的这些终端命令执行以下clone-to-launch(从克隆到运行)的步骤。 git clone https://github.com/angularquickstartgit quickstart cd quickstart npm install npm start
(注:
npm install类似于maven,即根据依赖配置文件package.json来下载所需要的依赖包。
参考:https://docs.npmjs.com/cli/install。)
下载Download the QuickStart seed (下载QuickStart seed)并且解压它到你的项目文件夹中。 然后用下面的这些命令执行剩余的步骤。 QuickStart seed里面有什么?这个QuickStart seed包含了就像QuickStart playground一样的应用程序。但是它的真正目的是为本地开发环境提供一个坚实的基础。所以,会有更多的文件在你的机器的这个目录中,其中的大部分,你稍后会学习到。 Focus on the following three TypeScript ( 重点在以下三个TypeScript (
app
import { Component} from '@angular/core'; @Component({ selector: 'my-app',template `<h1>Hello {{name}}</h1>`})exportclassAppComponent name = 'Angular'} 所有指导和操作手册都至少有这些核心文件。每一个文件有一个不同的目的,会随着应用的发展而独立地演化。
以下是原文,摘自:https://angular.io/docs/ts/latest/guide/setup.html。
Setup a local development environmentTheQuickStart live-codingexample is an Angularplayground. It's not where you'd develop a real application. Youshould develop locallyon your own machine ... and that's also how we think you should learn Angular. Setting up a new project on your machine is quick and easy with theQuickStart seed,maintainedon github. TheQuickStart seed live-exampleis QuickStartplusthe Make sure you havenode and npm installed. Then ...
ClonePerform theclone-to-launchsteps with these terminal commands. DownloadDownload the QuickStart seedand unzip it into your project folder. Then perform the remaining steps with these terminal commands. What's in the QuickStart seed?TheQuickStart seedcontains the same application as the QuickStart playground. But it's true purpose is to provide a solid foundation forlocaldevelopment. Consequently,there aremany more filesin the project folder on your machine,most of which you canlearn about later. Focus on the following three TypeScript (
main.ts
}
All guides and cookbooks haveat least these core files. Each file has a distinct purpose and evolves independently as the application grows.
Next StepIf you're new to Angular,we recommend staying on thelearning path. Appendix: node and npmNode.js and npm are essential to modern web development with Angular and other platforms. Node powers client development and build tools. Thenpmpackage manager,itself anodeapplication,installs JavaScript libraries. Get them nowif they're not already installed on your machine. Verify that you are running node We recommendnvmfor managing multiple versions of node and npm. You may neednvmif you already have projects running on your machine that use other versions of node and npm. Appendix: Why develop locallyLive codingin the browser is a great way to explore Angular. Links on almost every documentation page open completed samples in the browser. You can play with the sample code,share your changes with friends,and download and run the code on your own machine. TheQuickStartshows just the As much fun as this is ...
Use thelive codingenvironment as aplayground,a place to try the documentation samples and experiment on your own. It's the perfect place to reproduce a bug when you want tofile a documentation issueorfile an issue with Angular itself. For real development,we strongly recommenddeveloping locally. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |