应用程序池添加版本_如何将版本添加到角度应用程序
应用程序池添加版本
角度的 (Angular)
In this article, I will share a simple configuration to import the package.json file into your Angular application.
在本文中,我将分享一个简单的配置,将package.json文件导入您的Angular应用程序。
- Import @types/node 导入@ types / node
- Add configuration to tsconfig.app.json 将配置添加到tsconfig.app.json
- Import package.json to Angular component 将package.json导入Angular组件
The purpose of this is very simple. Sometimes, we want to import package.json to Angular components to get the version number and display in the template.
这样的目的很简单。 有时,我们想将package.json导入Angular组件以获取版本号并显示在模板中。
Here is how I do it.
这是我的方法。
导入@ types / node (Import @types/node)
This package contains type definitions for Node.js. It will help you to recognize node syntax.
该软件包包含Node.js的类型定义。 这将帮助您识别节点语法。
You can install it here.
您可以在这里安装它。
将配置添加到tsconfig.app.json (Add Configuration to tsconfig.app.json)
You need node
types in the tsconfig.app.json as below.
您需要在tsconfig.app.json中添加以下node
类型。
将Package.json导入Angular组件 (Import Package.json to Angular Component)
The reason why I add @type/node
here is that I want to use the require()
syntax to import package.json to my Angular component.
我在此处添加@type/node
的原因是我想使用require()
语法将package.json导入到我的Angular组件中。
I have tried by using import
. But, it is not successful for Angular application.
我已经尝试通过使用import
。 但是,它对于Angular应用程序并不成功。
Now we can put the version into html template and use it.
现在我们可以将版本放入html模板并使用它。
翻译自: https://levelup.gitconnected.com/how-to-add-version-to-angular-application-610c47201c7f
应用程序池添加版本