安裝angular cli_Angular 9適用于初學者—如何使用Angular CLI安裝第一個應用程序

安裝angular cli

Angular is one of the most popular JavaScript frameworks created and developed by Google. In the last couple of years, ReactJS has gained a lot of interest and has become the most popular modern JS library in the industry. But this doesn’t mean Angular is not important anymore.

Angular是Google創建和開發的最受歡迎JavaScript框架之一。 在過去的幾年中,ReactJS引起了很多興趣,并已成為業界最受歡迎的現代JS庫。 但這并不意味著Angular不再重要。

On the contrary, Angular is the second most popular framework after React according to Google Trends (world-wide):

相反,根據Google趨勢(全球),Angular是僅次于React的第二受歡迎的框架:

As a front end developer, I have worked with Angular. Now I would like to cover some important features of Angular in my upcoming articles:

作為前端開發人員,我曾與Angular合作。 現在,我想在即將發表的文章中介紹Angular的一些重要功能:

  • Part 1: How to install your first App with the Angular CLI (currently you’re here)

    第1部分:如何使用Angular CLI安裝第一個應用程序(當前在這里)

  • Part 2: Angular Components & String Interpolation

    第2部分: 角度組件和字符串插值

  • Part 3: Angular Directives & Pipes

    第3部分 : 角度指令和管道

  • Part 4: One-Way Data Binding in Angular

    第4部分: Angular中的單向數據綁定

  • Part 5: Angular Two-Way Data Binding with ngModel

    第5部分: 使用ngModel進行角度雙向數據綁定

In the first part of my Angular for Beginners series, you’re going to learn what Angular & Angular CLI is and how to install your first Angular app by using the CLI.

在我的Angular for Beginners系列的第一部分中,您將學習什么是Angular&Angular CLI以及如何使用CLI安裝第一個Angular應用程序。

先決條件 (Prerequisites)

Before starting to learn Angular, I recommend that you become familiar with the following languages if you aren't already:

在開始學習Angular之前,我建議您先熟悉以下語言:

  • HTML, CSS

    HTML,CSS
  • JavaScript / ES6

    JavaScript / ES6
  • TypeScript

    打字稿

If you prefer, you can watch the tutorial video below:

如果愿意,您可以觀看下面的教程視頻:

什么是角度? (What is Angular?)

Angular is a JavaScript framework developed and maintained by Google for building front-end applications. Let me start first explaining what a framework is…

Angular是Google開發和維護的用于構建前端應用程序JavaScript框架。 讓我首先開始解釋什么是框架...

什么是框架? (What is a Framework?)

A ?Framework is a complete package with its own functionalities & libraries. A Framework has its own rules, you don’t have much flexibility and the project is dependent on the Framework you use. Angular is an example of a framework.

框架是具有其自身功能和庫的完整軟件包。 框架有自己的規則,您沒有太多的靈活性,并且項目取決于您使用的框架。 Angular是框架的一個示例。

Angular has released in 2016 but before Angular, there was AngularJS. One of the most asked questions about Angular is that what is the difference between AngularJS and Angular?

Angular已于2016年發布,但在Angular之前有AngularJS。 關于Angular的最常見問題之一是AngularJS和Angular有什么區別?

AngularJS和Angular (AngularJS vs Angular)

These ?2 versions of Angular confuse many developers. AngularJS and Angular are completely different frameworks. Angular versions (like 1, 1.2, 1.5, ?etc) are called Angular JS and starting from version 2 and above is called Angular.

這兩個Angular版本使許多開發人員感到困惑。 AngularJS和Angular是完全不同的框架。 Angular版本(例如1、1.2、1.5等)稱為Angular JS,從版本2及更高版本開始稱為Angular。

  • Angular JS → versions from 1.x

    Angular JS→版本1.x
  • Angular → version 2 and above

    Angular→版本2及更高版本

So ?Angular version 2 is a complete rewrite of the AngularJS framework and the newer versions (like 4,5,6 and so on) are minor changes of Angular version 2.

因此,Angular版本2是對AngularJS框架的完全重寫,而較新的版本(例如4,5,6等)是Angular版本2的較小更改。

In this article series, you’re going to learn Angular 2+.

在本系列文章中,您將學習Angular 2+。

什么是Angular CLI? (What is Angular CLI?)

CLI ?stands for Command Line Interface. Angular has its own official CLI ?that helps us with lots of things during the development process.

CLI代表命令行界面。 Angular擁有自己的官方CLI,可在開發過程中為我們提供許多幫助。

Angular CLI is being used for automating operations in Angular projects rather than doing them manually. CLI supports us, developers, in an Angular project ?from beginning to end.

Angular CLI用于自動執行Angular項目中的操作,而不是手動執行操作。 CLI從始至終都在Angular項目中為我們開發人員提供支持。

For example, Angular CLI can be used for:

例如,Angular CLI可用于:

  • Configurations, Environment Setup

    配置,環境設置
  • Building components, services, routing system

    建筑構件,服務,路由系統
  • Starting, testing and deploying the project

    開始,測試和部署項目
  • Installing 3rd party libraries (like Bootstrap, Sass, etc.)

    安裝第三方庫(例如Bootstrap,Sass等)

and much more. Now let’s see how to install our first Angular App by using the CLI step by step.

以及更多。 現在,讓我們逐步了解如何使用CLI安裝第一個Angular App。

步驟1:安裝NPM(節點程序包管理器) (Step 1: Install NPM (Node Package Manager))

First ?of all, we are going to need Node js. NPM (node package manager, is a part of node js) is a tool for installing 3rd party libraries and dependencies to our project. If you don’t have it yet, you can download and install it from here. I have also explained it step by step on the tutorial video.

首先,我們將需要Node js。 NPM(節點程序包管理器,是節點js的一部分)是一個用于將第三方庫及其依賴項安裝到我們的項目的工具。 如果還沒有,可以從這里下載并安裝。 我還在教程視頻中逐步介紹了它。

步驟2:安裝Angular CLI (Step 2: Install Angular CLI)

If you have node js installed, the next step is installing the Angular CLI itself to your computer:

如果您已安裝node js,則下一步是將Angular CLI本身安裝到您的計算機上:

npm install -g @angular/cli

g stands for global installation. If you use -g later you can use the CLI in any Angular project on your computer.

g代表全局安裝 。 如果以后使用-g,則可以在計算機上的任何Angular項目中使用CLI。

Tip: Type ng v to your command-line interface (or terminal) to verify your Angular version.

提示 :在命令行界面(或終端)上輸入ng v以驗證您的Angular版本。

步驟3:建立新的Angular專案 (Step 3: Create a new Angular Project)

After the installation is completed, you can use Angular CLI to create a new Angular project with the following command:

安裝完成后,可以使用Angular CLI通過以下命令創建新的Angular項目:

ng new my-first-app

This ?command creates a new Angular project (named my-first-app, you can use any name) with all the necessary dependencies and files. You don’t have to worry about anything because the CLI does it automatically for you.

此命令將創建一個具有所有必要依賴項和文件的新Angular項目(名為my-first-app,您可以使用任何名稱)。 您無需擔心任何事情,因為CLI會自動為您執行操作。

步驟4:運行應用 (Step 4: Run the App)

After installing the CLI and creating a new Angular app, the final step is to start the project. To do that, we need to use the following command:

安裝CLI并創建新的Angular應用后,最后一步是啟動項目。 為此,我們需要使用以下命令:

ng serve -- open

The “open” flag opens your local browser window automatically.

“打開”標志會自動打開本地瀏覽器窗口。

Angular supports live server, so you can see the changes in your local without refreshing your browser’s page. For more details and updates, check also the official documentation.

Angular支持實時服務器 ,因此您可以在不刷新瀏覽器頁面的情況下查看本地更改。 有關更多詳細信息和更新,請參閱官方文檔 。

結論 (Conclusion)

So in the first part, we’ve made an introduction to Angular, what CLI is and how to install your first Angular app. In the second post, you’re going to learn about Angular Components and String Interpolation. Stay tuned :)

因此,在第一部分中,我們介紹了Angular,什么是CLI以及如何安裝第一個Angular應用程序。 在第二篇文章中,您將學習Angular Components和String Interpolation 。 敬請關注 :)

If you want to learn more about Web Development, feel free to follow me on Youtube!

如果您想了解有關Web開發的更多信息,請 隨時 在YouTube上關注我

Thank you for reading!

感謝您的閱讀!

翻譯自: https://www.freecodecamp.org/news/angular-9-for-beginners-how-to-install-your-first-app-with-angular-cli/

安裝angular cli

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/390519.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/390519.shtml
英文地址,請注明出處:http://en.pswp.cn/news/390519.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

leetcode 1818. 絕對差值和

給你兩個正整數數組 nums1 和 nums2 &#xff0c;數組的長度都是 n 。 數組 nums1 和 nums2 的 絕對差值和 定義為所有 |nums1[i] - nums2[i]|&#xff08;0 < i < n&#xff09;的 總和&#xff08;下標從 0 開始&#xff09;。 你可以選用 nums1 中的 任意一個 元素來…

【轉載】keil5中加入STM32F10X_HD,USE_STDPERIPH_DRIVER的原因

初學STM32&#xff0c;在RealView MDK 環境中使用STM32固件庫建立工程時&#xff0c;初學者可能會遇到編譯不通過的問題。出現如下警告或錯誤提示&#xff1a; warning: #223-D: function "assert_param" declared implicitly;assert_param(IS_GPIO_ALL_PERIPH(GPIOx…

下崗職工_下崗后我如何獲得多位軟件工程師的面試

下崗職工“Opportunities to find our deeper powers come when life seems most challenging.” -Joseph Campbell“當生活似乎最具挑戰性時&#xff0c;就有機會找到我們更深層的力量。” 約瑟夫坎貝爾 I was recently laid off for the first time in my life. I realized t…

1846. 減小和重新排列數組后的最大元素

給你一個正整數數組 arr 。請你對 arr 執行一些操作&#xff08;也可以不進行任何操作&#xff09;&#xff0c;使得數組滿足以下條件&#xff1a; arr 中 第一個 元素必須為 1 。任意相鄰兩個元素的差的絕對值 小于等于 1 &#xff0c;也就是說&#xff0c;對于任意的 1 <…

bashdb常用命令

一、列出代碼和查詢代碼類&#xff1a; l 列出當前行以下的10行- 列出正在執行的代碼行的前面10行. 回到正在執行的代碼行w 列出正在執行的代碼行前后的代碼/pat/ 向后搜索pat&#xff1f;pat&#xff1f;向前搜索pat二、Debug控制類&#xff1a; h 幫助help 命令 得到…

podcast播客資源_為什么播客是我的新維基百科-完美的非正式學習資源

podcast播客資源In this article, I’ll explain why podcasts replaced a lot of my Wikipedia usage for informal learning. I’ll also talk about how I listen to 5 hours of podcasts every day.在本文中&#xff0c;我將解釋為什么播客代替了我的許多Wikipedia用于非正…

劍指 Offer 53 - I. 在排序數組中查找數字 I(二分法)

統計一個數字在排序數組中出現的次數。 示例 1: 輸入: nums [5,7,7,8,8,10], target 8 輸出: 2 示例 2: 輸入: nums [5,7,7,8,8,10], target 6 輸出: 0 限制&#xff1a; 0 < 數組長度 < 50000 解題思路 先用二分法查找出其中一個目標元素再向目標元素兩邊查找…

MVC與三層架構區別

我們平時總是將三層架構與MVC混為一談&#xff0c;殊不知它倆并不是一個概念。下面我來為大家揭曉我所知道的一些真相。 首先&#xff0c;它倆根本不是一個概念。 三層架構是一個分層式的軟件體系架構設計&#xff0c;它可適用于任何一個項目。 MVC是一個設計模式&#xff0c;它…

tensorflow 實現邏輯回歸——原以為TensorFlow不擅長做線性回歸或者邏輯回歸,原來是這么簡單哇!...

實現的是預測 低 出生 體重 的 概率。尼克麥克盧爾&#xff08;Nick McClure&#xff09;. TensorFlow機器學習實戰指南 (智能系統與技術叢書) (Kindle 位置 1060-1061). Kindle 版本. # Logistic Regression #---------------------------------- # # This function shows ho…

sdlc 瀑布式 生命周期_SDLC指南–軟件開發生命周期的階段和方法

sdlc 瀑布式 生命周期When I decided to teach myself how to code almost four years ago I had never heard of, let alone thought about, the software development life cycle.當我差不多四年前決定教自己如何編碼時&#xff0c;我從未聽說過軟件開發生命周期&#xff0c;…

劍指 Offer 48. 最長不含重復字符的子字符串

請從字符串中找出一個最長的不包含重復字符的子字符串&#xff0c;計算該最長子字符串的長度。 示例 1: 輸入: “abcabcbb” 輸出: 3 解釋: 因為無重復字符的最長子串是 “abc”&#xff0c;所以其長度為 3。 示例 2: 輸入: “bbbbb” 輸出: 1 解釋: 因為無重復字符的最長子…

Mysql-my-innodb-heavy-4G.cnf配置文件注解

Mysql-同Nginx等一樣具備多實例的特點&#xff0c;簡單的講就是在一臺服務器上同時開啟多個不同的服務端口&#xff08;3306,3307&#xff09;同時運行多個Mysql服務進程&#xff0c;這些服務進程通過不同的socket監聽不同的服務端口來提供服務。這些Mysql多實例公用一套Mysql安…

is 和 == 的區別

is 和 操作符的區別 python官方解釋&#xff1a; 的meaning為equal&#xff1b; is的meaning為object identity&#xff1b; is 判斷對象是否相等&#xff0c;即身份是否相同&#xff0c;使用id值判斷&#xff1b; 判斷對象的值是否相等。id值是什么&#xff1f;id()函數官網…

win10管理凌亂桌面_用于管理凌亂的開源存儲庫的命令行技巧

win10管理凌亂桌面Effective collaboration, especially in open source software development, starts with effective organization. To make sure that nothing gets missed, the general rule, “one issue, one pull request” is a nice rule of thumb.有效的協作(特別是…

JAVA數組Java StringBuffer 和 StringBuilder 類

版權聲明&#xff1a;本文為博主原創文章&#xff0c;未經博主允許不得轉載。 https://blog.csdn.net/qq_34173549/article/details/80215173 Java StringBuffer 和 StringBuilder 類 當對字符串進行修改的時候&#xff0c;需要使用 StringBuffer 和 StringBuilder 類。 和 Str…

strlen和sizeof的長度區別

strlen返回字符長度 而sizeof返回整個數組占多長&#xff0c;字符串的\0也會計入一個長度轉載于:https://www.cnblogs.com/DawaTech/p/8086055.html

了解如何使用Yii2 PHP框架創建YouTube克隆

Yii is a fast, secure, and efficient PHP framework used to create all kinds of web apps. Weve released a full video course on how to use the Yii2 framework.Yii是一個快速&#xff0c;安全&#xff0c;高效PHP框架&#xff0c;用于創建各種Web應用程序。 我們已經發…

劍指 Offer 66. 構建乘積數組

給定一個數組 A[0,1,…,n-1]&#xff0c;請構建一個數組 B[0,1,…,n-1]&#xff0c;其中 B[i] 的值是數組 A 中除了下標 i 以外的元素的積, 即 B[i]A[0]A[1]…A[i-1]A[i1]…A[n-1]。不能使用除法。 示例: 輸入: [1,2,3,4,5] 輸出: [120,60,40,30,24] 提示&#xff1a; 所有…

Statement與PreparedStatement的區別

Statement與PreparedStatement的區別 PreparedStatement預編譯SQL語句&#xff0c;性能好。 PreparedStatement無序拼接SQL語句&#xff0c;編程更簡單. PreparedStatement可以防止SQL注入&#xff0c;安全性好。 Statement由方法createStatement()創建&#xff0c;該對象用于發…

劍指 Offer 45. 把數組排成最小的數

輸入一個非負整數數組&#xff0c;把數組里所有數字拼接起來排成一個數&#xff0c;打印能拼接出的所有數字中最小的一個。 示例 1: 輸入: [10,2] 輸出: “102” 示例 2: 輸入: [3,30,34,5,9] 輸出: “3033459” 提示: 0 < nums.length < 100 說明: 輸出結果可能非…