Angular Material - Tutorialspoint

3y ago
218 Views
37 Downloads
855.38 KB
17 Pages
Last View : 2m ago
Last Download : 3m ago
Upload by : Camille Dion
Transcription

Angular Materiali

Angular MaterialAbout the TutorialAngular Material is a UI component library for Angular JS developers. Angular Materialcomponents help in constructing attractive, consistent, and functional web pages and webapplications while adhering to modern web design principles like browser portability, deviceindependence, and graceful degradation. It helps in creating faster, beautiful, and responsivewebsites. It is inspired by the Google Material Design.AudienceThis tutorial is meant for professionals who aspire to learn the basics of Angular Material andhow to use it to create faster, beautiful, and responsive websites. This tutorial explains thefundamental concepts of Angular Material.PrerequisitesBefore proceeding with this tutorial, you should have a basic understanding of Angular JS,HTML, CSS, JavaScript, Document Object Model (DOM), and any text editor. In addition, it willhelp if you know how web-based applications work.Execute Angular Material OnlineFor most of the examples given in this tutorial, you will find a Try-it option. Use this option toexecute your Angular Material programs then and there and enjoy your learning.Try the following example using the Try-it option available at the top right corner of thefollowing sample code box – html lang "en" head link rel "stylesheet"href "https://ajax.googleapis.com/ajax/libs/angular material/1.0.0/angularmaterial.min.css" scriptsrc .4.8/angular.min.js" /script script src .4.8/angularanimate.min.js" /script script src .4.8/angulararia.min.js" /script script src .4.8/angularmessages.min.js" /script scriptsrc "https://ajax.googleapis.com/ajax/libs/angular material/1.0.0/angularmaterial.min.js" /script script type "text/javascript" angular.module('firstApplication', ['ngMaterial']);i

Angular Material /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 HTML4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presentingcontent on the World Wide Web. /p p HTML5 is a cooperation between the World Wide Web Consortium (W3C) andthe Web Hypertext Application Technology Working Group (WHATWG). /p p The new standard incorporates features like video playback and drag-anddrop that have been previously dependent on third-party browser plug-ins such asAdobe Flash, Microsoft Silverlight, and Google Gears. /p /md-content /body /html Copyright & Disclaimer Copyright 2017 by Tutorials Point (I) Pvt. Ltd.All the content and graphics published in this e-book are the property of Tutorials Point (I) Pvt.Ltd. The user of this e-book is prohibited to reuse, retain, copy, distribute or republish anycontents or a part of contents of this e-book in any manner without written consent of thepublisher.We strive to update the contents of our website and tutorials as timely and as precisely aspossible, however, the contents may contain inaccuracies or errors. Tutorials Point (I) Pvt. Ltd.provides no guarantee regarding the accuracy, timeliness or completeness of our website or itscontents including this tutorial. If you discover any errors on our website or in this tutorial,please notify us at contact@tutorialspoint.comii

Angular MaterialTable of ContentsAbout the Tutorial . iAudience . iPrerequisites . iExecute Angular Material Online . iCopyright & Disclaimer . iiTable of Contents . iii1.ANGULAR MATERIAL – OVERVIEW . 12.ANGULAR MATERIAL – ENVIRONMENT SETUP . 2How to Use Angular Material? . 2Local Installation . 2CDN Based Version . 43.ANGULAR MATERIAL – AUTOCOMPLETE. 6Attributes . 64.ANGULAR MATERIAL – BOTTOM SHEET . 135.ANGULAR MATERIAL – CARDS. 176.ANGULAR MATERIAL – WIDGETS . 23Angular Material – Buttons . 26Angular Material – CheckBoxes . 33Angular Material – Content . 35Angular Material – DatePicker. 37Angular Material – Dialogs . 41Angular Material – Divider . 45Angular Material – List . 48iii

Angular MaterialAngular Material – Menu . 51Angular Material - Menu Bar . 54Angular Material – Progress Bars . 57Angular Material – Radio Buttons . 64Angular Material – Selects . 67Angular Material – Fab Toolbars. 70Angular Material – Sliders . 73Angular Material – Tabs . 76Angular Material – Toolbars . 80Angular Material – Tooltips . 84Angular Material – Chips . 87Angular Material – Contact Chips . 927.ANGULAR MATERIAL – LAYOUTS. 97Layout Directive . 97Flex Directive . 1008.ANGULAR MATERIAL – INPUTS . 1039.ANGULAR MATERIAL – ICONS . 10710. ANGULAR MATERIAL – GRIDS . 112Attributes . 11211. ANGULAR MATERIAL – SIDENAV . 11612. ANGULAR MATERIAL – FAB SPEED DIAL . 119Attributes . 11913. ANGULAR MATERIAL – SUBHEADERS . 12414. ANGULAR MATERIAL – SWIPE . 127iv

Angular Material15. ANGULAR MATERIAL – SWITCHES . 13016. ANGULAR MATERIAL – THEME. 13517. ANGULAR MATERIAL – TOASTS . 13918. ANGULAR MATERIAL – TYPOGRAPHY . 14119. ANGULAR MATERIAL – VIRTUAL REPEAT. 144Attributes . 144md-virtual-repeat . 14420. ANGULAR MATERIAL – WHITEFRAME . 150v

1. ANGULAR MATERIAL – OVERVIEWAngular MaterialAngular Material is a UI component library for Angular JS developers. Angular Material'sreusable UI components help in constructing attractive, consistent, and functional web pagesand web applications while adhering to modern web design principles like browser portability,device independence, and graceful degradation.Following are a few salient features of Angular Material: In-built responsive designing. Standard CSS with minimal footprint. Includes new versions of common user interface controls such as buttons, check boxes,and text fields which are adapted to follow Material Design concepts. Includes enhanced and specialized features like cards, toolbar, speed dial, side nav,swipe, and so on. Cross-browser, and can be used to create reusable web components.Responsive Design Angular Material has in-built responsive designing so that the website created usingAngular Material will redesign itself as per the device size. Angular Material classes are created in such a way that the website can fit any screensize. The websites created using Angular Material are fully compatible with PC, tablets, andmobile devices.Extensible Angular Material is by design very minimal and flat. It is designed considering the fact that it is much easier to add new CSS rules than tooverwrite existing CSS rules. It supports shadows and bold colors. The colors and shades remain uniform across various platforms and devices.And most important of all, Angular Material is absolutely free to use.6

2. ANGULAR MATERIAL – ENVIRONMENT SETUPAngular MaterialHow to Use Angular Material?There are two ways to use Angular Material: Local Installation - You can download the Angular Material libraries using npm, jspm,or bower on your local machine and include it in your HTML code. CDN Based Version - You can include the angular-material.min.css and angularmaterial js files into your HTML code directly from the Content Delivery Network (CDN).Local InstallationBefor we use the following npm command, we require the NodeJS installation on our system.To get information about node JS, click here and open the NodeJS command line interface.We will use the following command to install Angular Material libraries.npm install angular-materialThe above command will generate the following output angular-animate@1.5.2 node modules\angular-animateangular-aria@1.5.2 node modules\angular-ariaangular-messages@1.5.2 node modules\angular-messagesangular@1.5.2 node modules\angularangular-material@1.0.6 node modules\angular-materialnpm will download the files under node modules angular-material folder. Include thefiles as explained in the following example ExampleNow you can include the css and js file in your HTML file as follows html lang "en" 7

Angular Material head link rel "stylesheet" href "/node modules/angular-material/angularmaterial.css" script src "/node modules/angular-material/angular.js" /script script src "/node modules/angular-material/angular-animate.js" /script script src "/node modules/angular-material/angular-aria.js" /script script src "/node modules/angular-material/angular-messages.js" /script script src "/node modules/angular-material/angular-material.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 HTML4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presentingcontent on the World Wide Web. /p p HTML5 is a cooperation between the World Wide Web Consortium (W3C) andthe Web Hypertext Application Technology Working Group (WHATWG). /p p The new standard incorporates features like video playback and dragand-drop that have been previously dependent on third-party browser plug-ins suchas Adobe Flash, Microsoft Silverlight, and Google Gears. /p /md-content /body /html The above program will generate the following result –8

Angular MaterialCDN Based VersionYou can include the angular-material.css and angular-material.js files into your HTMLcode directly from the Content Delivery Network (CDN). Google CDN provides content for thelatest version.We are using the Google CDN version of the library throughout this tutorial.ExampleNow let us rewrite the above example using angular-material.min.css and angularmaterial.min.js from Google CDN. html lang "en" head link rel "stylesheet"href "https://ajax.googleapis.com/ajax/libs/angular material/1.0.0/angularmaterial.min.css" scriptsrc .4.8/angular.min.js" /script script src .4.8/angularanimate.min.js" /script script src .4.8/angulararia.min.js" /script script src .4.8/angularmessages.min.js" /script scriptsrc "https://ajax.googleapis.com/ajax/libs/angular material/1.0.0/angularmaterial.min.js" /script script type "text/javascript" angular.module('firstApplication', ['ngMaterial']);9

Angular Material /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 HTML4.01, XHTML 1.0, and XHTML 1.1. HTML5 is a standard for structuring and presentingcontent on the World Wide Web. /p p HTML5 is a cooperation between the World Wide Web Consortium (W3C) andthe Web Hypertext Application Technology Working Group (WHATWG). /p p The new standard incorporates features like video playback and dragand-drop that have been previously dependent on third-party browser plug-ins suchas Adobe Flash, Microsoft Silverlight, and Google Gears. /p /md-content /body /html The above program will generate the following result –10

3. ANGULAR MATERIAL – AUTOCOMPLETEAngular MaterialThe md-autocomplete, an Angular Directive, is used as a special input control with an inbuiltdropdown to show all possible matches to a custom query. This control acts as a real-timesuggestion box as soon as the user types in the input area. md-autocomplete can beused to provide search results from local or remote data sources. md-autocomplete cachesresults when performing a query. After first call, it uses the cached results to eliminateunnecessary server requests or lookup logic and it can be disabled.AttributesThe following table lists out the parameters and description of the different attributes of mdautocomplete.S.No.1234567Parameter & Description* md-itemsAn expression in the format of item in items to iterate over matches for your search.md-selected-item-changeAn expression to be run each time a new item is selected.md-search-text-changeAn expression to be run each time the search text updates.md-search-textA model to bind the search query text to.md-selected-itemA model to bind the selected item to.md-item-textAn expression that will convert your object to a single string.placeholderPlaceholder text that will be forwarded to the input.11

Angular MaterialS.No.8910111213141516171819Parameter & Descriptionmd-no-cacheDisables the internal caching that happens in autocomplete.ng-disabledDetermines whether or not to disable the input field.md-min-lengthSpecifies the minimum length of text before autocomplete will make suggestions.md-delaySpecifies the amount of time (in milliseconds) to wait before looking for results.md-autofocusIf true, will immediately focus the input element.md-autoselectIf true, the first item will be selected by default.md-menu-classThis will be applied to the dropdown menu for styling.md-floating-labelThis will add a floating label to autocomplete and wrap it in the md-input-container.md-input-nameThe name attribute given to the input element to be used with the FormController.md-input-idAn ID to be added to the input element.md-input-minlengthThe minimum length for the input's value for validation.md-input-maxlength12

Angular MaterialS.No.Param

Angular Material 11 The md-autocomplete, an Angular Directive, is used as a special input control with an inbuilt dropdown to show all possible matches to a custom query. This control acts as a real-time suggestion box as soon as the user types in the input area.

Related Documents:

it could be considered a new framework. Angular versions 2 and up are backward compatible till the Angular 2, but not with Angular 1. To avoid confusion, Angular 1 is now named Angu-lar JS and Angular versions 2 and higher are named Angular. Angular JS is based on JavaScript while Angular is based on JavaScript superset called TypeScript.

Angular Kinetics similar comparison between linear and angular kinematics Mass Moment of inertia Force Torque Momentum Angular momentum Newton’s Laws Newton’s Laws (angular analogs) Linear Angular resistance to angular motion (like linear motion) dependent on mass however, the more closely mass is distributed to the

Both Angular 2 and 4 are open-source, TypeScript-based front-end web application platforms. is the latest version of Angular. Although Angular 2 was a complete rewrite of AngularJS, there are no major differences between Angular 2 and Angular 4. Angular 4 is only an improvement and is backward compatible with Angular 2.

0. Since the angular measure q is the angular analog of the linear distance measure, it is natural to define the average angular velocity Xw\ as Xw\ q f-q 0 Dt where q 0 is the initial angular position of the object when Dt 0 and q f is the final angular position of the object after a time Dt of angular motion.

The structure of Angular is based on the components/services architecture. AngularJS was based on the model view controller. Angular 4 released in March 2017 proves to be a major breakthrough and is the latest release from the Angular team after Angular2. Angular 4 is almost the same as A

Mobile Angular UI is an open-source framework for developing hybrid mobile apps. Mobile Angular UI makes use of Twitter Bootstrap and AngularJS that helps to create attractive HTML5 hybrid mobile and desktop apps. Features of Mobile Angular UI Mobile Angular UI has some cool components that are listed below:

Chapter 1: Getting started with Angular Remarks Angular (commonly referred to as "Angular 2 " or "Angular 2") is a TypeScript-based open-source front-end web framework led by the Angular Team at Google and by a community of individuals and corporations to address all of the parts of the developer's workflow while building complex web applications.

Angular JS Angular Course Curriculum Our Angular course content covers all Client-side technologies which is prepared by our Angular experts to make it suitable for everyone and ensure that it covers all the industry related skills and techniques to start a successful career growth. Our Experts always updating the Angular