angular 生成二维码
In this tutorial, we’ll learn how to generate QR codes in Angular by building a simple example application using the latest Angular 10 version. But first of all, what is a QR code anyway, and what purpose does it serve?
在本教程中,我们将通过使用最新的Angular 10版本构建一个简单的示例应用程序,学习如何在Angular中生成QR代码。 但是首先,什么是QR码,它的目的是什么?
According to Wikipedia “A QR code (abbreviated from Quick Response code) is a type of matrix barcode (or two-dimensional barcode) [that]… often contain[s] data for a locator, identifier, or tracker that points to a website or application. A QR code uses four standardized encoding modes (numeric, alphanumeric, byte/binary, and kanji) to store data efficiently.”
根据Wikipedia的说法,“ QR码(缩写为快速响应代码)是一种矩阵条形码(或二维条形码),[...]…通常包含指向网站的定位器,标识符或跟踪器的数据。或应用程序。 QR码使用四种标准化的编码模式(数字,字母数字,字节/二进制和汉字)来有效地存储数据。”
Put simply, a QR code is a compact and efficient way of storing data. Now let’s look at how to generate QR codes in your Angular 10 apps by example.
简而言之,QR码是一种紧凑而有效的数据存储方式。 现在,让我们看一下如何在Angular 10应用程序中生成QR码。
先决条件 (Prerequisites)
Before getting started you need a few things:
在开始之前,您需要注意以下几点:
- Basic knowledge of TypeScript, particularly familiarity with Object-Oriented concepts such as TypeScript classes and decorators. TypeScript的基本知识,尤其熟悉面向对象的概念,例如TypeScript类和装饰器。
A local development machine with Node 10+, together with NPM 6+ installed. Node is required by the Angular CLI like the most frontend tools nowadays. You can simply go to the download page of the official website and download the binaries for your operating system. You can also refer to your specific system instructions for how to install Node using a package manager. The recommended way though is using NVM — Node Version Manager — a POSIX-compliant bash script to manage multiple active Node.js versions.
装有Node 10+