- 教程
- 概述
- 环境设置(Environment Setup)
- 自动完成(Autocomplete)
- 角材料 - 底板(Bottom Sheet)
- Cards
- 小部件(Widgets)
- 布局(Layouts)
- 输入(Inputs)
- Icons
- Grids
- SideNav(SideNav)
- Fab 速拨号(Fab Speed Dial)
- 子头(Subheaders)
- Swipe
- 开关(Switches)
- 主题(Themes)
- 祝酒词(Toasts)
- 排版(Typography)
- 虚拟重复(Virtual Repeat)
- 白色框架(WhiteFrame)
- 有用的资源
- Buttons
- CheckBoxes
- Content
- DatePicker
- Dialogs
- Divider
- List
- Menu
- Menu Bar
- Progress Bars
- Radio Buttons
- Selects
- ListBox和ListCtrl(ListBox & ListCtrl)
- Sliders
- Tabs
- Toolbars
- Tooltips
- Chips
- Contact Chips
文章来源于网络收集而来,版权归原创者所有,如有侵权请及时联系!
环境设置(Environment Setup)
如何使用Angular_material?
有两种方法可以使用Angular材料 -
Local Installation - 您可以在本地计算机上使用npm,jspm或bower下载Angular Material库,并将其包含在HTML代码中。
CDN Based Version - 您可以直接从Content Delivery Network(CDN)将angular-material.min.css和angular-material js文件包含到HTML代码中。
本地安装 (Local Installation)
因为我们使用以下npm命令,我们需要在我们的系统上安装NodeJS。 要获取有关节点JS的信息,请单击here并打开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文件夹node_modules 》 angular-material下的文件。 按照以下示例中的说明包含文件 -
例子 (Example)
现在,您可以在HTML文件中包含css和js文件,如下所示 -
<html lang = "en">
<head>
<link rel = "stylesheet"
href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<script type = "text/javascript">
angular.module('firstApplication', ['ngMaterial']);
</script>
</head>
<body ng-app = "firstApplication" ng-cloak>
<md-toolbar class = "md-warn">
<div class = "md-toolbar-tools">
<h2 class = "md-flex">HTML 5</h2>
</div>
</md-toolbar>
<md-content flex layout-padding>
<p>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.</p>
<p>HTML5 is a cooperation between the World Wide Web Consortium (W3C) and
the Web Hypertext Application Technology Working Group (WHATWG).</p>
<p>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.</p>
</md-content>
</body>
</html>
CDN Based Version
您可以直接从Content Delivery Network(CDN)将angular-material.css和angular-material.js文件包含到HTML代码中。 Google CDN提供最新版本的内容。
我们在本教程中使用了该库的Google CDN版本。
例子 (Example)
现在让我们使用来自Google CDN的angular-material.min.css和angular-material.min.js重写上面的例子。
<html lang = "en" >
<head>
<link rel = "stylesheet"
href = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.css">
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-animate.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-aria.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular-messages.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angular_material/1.0.0/angular-material.min.js"></script>
<script type = "text/javascript">
angular.module('firstApplication', ['ngMaterial']);
</script>
</head>
<body ng-app = "firstApplication" ng-cloak>
<md-toolbar class = "md-warn">
<div class = "md-toolbar-tools">
<h2 class = "md-flex">HTML 5</h2>
</div>
</md-toolbar>
<md-content flex layout-padding>
<p>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.</p>
<p>HTML5 is a cooperation between the World Wide Web Consortium (W3C) and the Web
ypertext Application Technology Working Group (WHATWG).</p>
<p>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.</p>
</md-content>
</body>
</html>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论