AngularJS setup for local development

1 要 install : Angular QuickStart seed , 這樣開發比較快

2 Setup a local development environment

2.1 要先install : node and npm (note1)
2.2 然後,

-Create a project folder (you can call it quickstart and rename it later).

-Clone or download the QuickStart seed (note4) into your project folder.

-Install npm packages. (note3)

-Run npm start to launch the sample application.

(note2)

Focus on the following three TypeScript (.ts) files in the /src folder.

  • Files outside src/ concern building, deploying, and testing your app. They include configuration files and external dependencies. // src/外的 是作app 部署測試用
  • Files inside src/ “belong" to your app. Add new Typescript, HTML and CSS files inside the src/ directory, most of them inside src/app, unless told to do otherwise. //所以 src/ 內的都是自己的app

src/ 裡有 3 files:

1.app/app.component.ts : 定義AppComponent, 這是root component.
2.app/app.module.ts : 定義 AppModule, the root module that tells Angular how to assemble the application.
3.main.ts : Compiles the application with the JIT compiler and bootstraps the application’s main module (AppModule) to run in the browser

  • 檔案結構看起來會像是這樣: (pic1)

maxthonsnap20170219085429

(pic1)

然後, 讀 : https://angular.io/docs/ts/latest/guide/learning-angular.html

 

(note1:Installing Node.js and updating npm //

https://docs.npmjs.com/getting-started/installing-node)

Node.js Download at https://nodejs.org/en/download/ )

(note2:https://angular.io/docs/ts/latest/guide/setup.html)

(note3:  Node.js and npm are essential to modern web development with Angular and other platforms. Node powers client development and build tools. The npm package manager, itself a node application, installs JavaScript libraries.)

(note4:"the QuickStart seed" : 目的是作為本地開發的基礎, project folder 內有很多files.)

Advertisements
舊文章
發表留言

1 則迴響

  1. AngularJS AppModule (the Root module) | Joe

發表迴響

在下方填入你的資料或按右方圖示以社群網站登入:

WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 / 變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 / 變更 )

Facebook照片

您的留言將使用 Facebook 帳號。 登出 / 變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 / 變更 )

連結到 %s

%d 位部落客按了讚: