Table of Contents
- Install Angular Material in an Angular project:
ng add @angular/material
- Install Angular Flex Layout
ng add @angular/flex-layout
- Import required Modules in a given component:
import { BrowserAnimationModule } from '@angular/platform-browser/animations'
import { FlexLayoutModule } from '@angular/flex-layout'
import { FormsModule } from '@angular/forms'
- Create a separate module to contain all Material related modules
ng g m shared/material
- Container div
display: flex
flex-direction
column
/row
flex-wrap
wrap
justify-content
space-around
/flex-start
- HTML Attributes
fxLayout="row"
fxLayoutAlign="start center"
fxLayoutAlign="space-between stretch"
- On small screen sets flex-direction to column
fxLayout.xs="column"
- Bootstrap Icons
- use content of element inside svg element for adding inline content
- Google Fonts Icons
- Find an icon and use its name in the following format
<mat-icon>ICON_NAME</mat-icon>
- Find an icon and use its name in the following format
- Icons8
- Click on icon, Embed HTML, Base64, use img element
https://material.angular.io/components/icon/overview#svg-icons
- In order to use external icons in the website:
- Copy SVG file containing SVG set in a folder e.g.
./src/assets/
- add
MatIconRegistry
module into component constructor - add
DomSanitizer
module into component constructor iconRegistry.addSvgIconSet(sanitizer.bypassSecurityTrustResourceUrl('assets/file.svg')
- Official Documentation: https://material.angular.io/
- Flexbox Layout Demo: https://tburleson-layouts-demos.firebaseapp.com/#/docs
- CSS Tricks Flexbox: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
- CSS Tricks CSS Grid: https://css-tricks.com/snippets/css/complete-guide-grid/
- ClipPath generator: