安装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.mzph.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 说明: 输出结果可能非…