如何使用Angular材料?
有两种方法可以使用Angular Material :
本地安装 : 您可以在本地计算机上使用npm,jspm或bower下载Angular Material库,并将其包含在HTML代码中.
基于CDN的版本 : 您可以直接从Content Delivery Network(CDN)将angular-material.min.css和angular-material js文件包含到HTML代码中.
本地安装
因为我们使用以下npm命令,我们需要在我们的系统上安装NodeJS.要获取有关节点JS的信息,然后打开NodeJS命令行界面.我们将使用以下命令安装Angular Material库.
npm install angular-material
以上命令将生成以下输出 :
angular-animate@1.5.2 node_modules\angular-animate angular-aria@1.5.2 node_modules\angular-aria angular-messages@1.5.2 node_modules\angular-messages angular@1.5.2 node_modules \angular angular-material@1.0.6 node_modules\angular-material
npm 将下载 node_modules>下的文件. angular-material 文件夹.包括以下示例中所述的文件 :
示例
现在您可以包含 css 和 js
HTML 5
HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.
HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web Hypertext Application Technology Working Group (WHATWG).
The new standard incorporates features like video playback and drag-and-drop that have been previously dependent on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight, and Google Gears.
基于CDN的版本
您可以直接从Content Delivery Network(CDN)将angular-material.css和angular-material.js文件包含到HTML代码中。 Google CDN提供最新版本的内容。
我们在本教程中使用了该库的Google CDN版本。
示例
现在让我们使用来自Google CDN的angular-material.min.css和angular-material.min.js重写上面的例子。
HTML 5
HTML5 is the next major revision of the HTML standard superseding HTML 4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presenting content on the World Wide Web.
HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web ypertext Application Technology Working Group (WHATWG).
The new standard incorporates features like video playback and drag-and-drop that have been previously dependent on third-party browser plug-ins such as Adobe Flash, Microsoft Silverlight, and Google Gears.