Angular Material UI

Angular Material UI

IMO you need to know 3 things before reading this article:

  • Authentication and Authorization in Angular. Whether you wanna use casl or anything else
  • Know what is lvy. It is simple, It is just Angular compiler. But you can read more about it in google.
  • Knowing Angular routing module and how it works
  • Knowing the Angular fundamentals. for that read this post.

So let me begin with elaborating its definition:

  • IMO It is just another bootstrap with some ace
  • It is just pre-written components and css classes which speed up the development process. BTW we have also Angular Flex-Layout which is also developed and is maintained by Angular team, but is a separated library.


CDK stands for Component Dev Kit

Which is a set of behavior for building UI components.


Now to install Angular material do this:

ng add @angular/material

When you run this command it will asks you - It did in v14 - to set up global Angular Material typography style or not. But before going forward I like to say what does it means exactly.

  • Angular uses typography which is a way to arrange texts in a way to be more: readable, legible, and appealing.
  • By default Angular Material UI typography won't be applied globally and you need to do something like this <div class="mat-typography"><h1>I am styled</h1></div>. But if you say yes to that former question you do not need to do that and you can just do this: <h1>I am styled by default</h1>

No alt text provided for this image

As you can see when we say yes it will add the class in index.html - The main HTML file. This is how it applies the typography globally. Now the second question rises, Do you want to include Angular animations? Let's break this one into simpler parts:

  • We all know what is animation in HTML world.
  • Here it is exactly like bootstrap animations AFAIK


Create angular-material module

To keep out AppModule clean and neat I prefer to create a new module for Angular Material UI imports. Note that --module tells cli to auto import it in AppModule and basically I like to delegate tedium boring foolish tasks to the CLI.

ng generate module angular-material --module app


As I said most of tasks done by CLI an finally we just need to do one thing in AppModule; adding schemas: [CUSTOM_ELEMENTS_SCHEMA], in the @NgModule.

  • TBH I am still not mastered over this guy. So maybe this post help you more. BTW please do not jump between foci and just keep in mind what I said.
  • This config allow us to use non-angular elements/properties with dash case standard without interfering in Angular functionalities.
  • Basically we call them web components where used to be to allow us define custom tags/properties.
  • BTW web components are useful in two scenario: 1. Let you to create reuseable html elements, 2. Migrate Angular apps to higher version. Here is a simple example of a web component:

<my-good-tag weird-prop="value">

Hello

</my-good-tag>

要查看或添加评论,请登录

Mohammad Jawad barati的更多文章

  • Write test for nanostores

    Write test for nanostores

    why I wrote this post in the first place? Lack of tut and doc around this awesome library that makes our lives easier…

    1 条评论
  • My very own Linux cheat sheet

    My very own Linux cheat sheet

    HAL: Hardware Abstraction Layer do abstract hardwares for us /sys is where we can see what is connected to the system…

    1 条评论
  • ?????? ???? ?? ?????

    ?????? ???? ?? ?????

    ?? ???? ????: ???? ???? 43 ???? ?? (????? ?? ??????) ?? ??? ???? ???? ? ??????? ?????. ??? ??? ??????? ??? 56 ???? ??…

    2 条评论
  • Create Angular project

    Create Angular project

    First please note that the following instructions are totally biased and is my favorite way of doing it. BTW if you…

  • Learn Angular fundamentals.

    Learn Angular fundamentals.

    Note that I am still a backend developer who is dealing with frontend stuff BTW it is not so hard. IMO Angular is much…

  • NestJS task scheduler

    NestJS task scheduler

    To tackle queue issues in NestJS we use @nestjs/schedule. With this package we can define declarative cron jobs.

  • OTP code in Node.js

    OTP code in Node.js

    Send a time-based OTP code - define TTL for the code Keep the symetric keys very safe Use approved cryptographic…

  • Refresh Token + Logout functionality in Node.js

    Refresh Token + Logout functionality in Node.js

    Here is how I implement refresh token in Node.js.

  • My journey in gPRC

    My journey in gPRC

    I am just fooling around gPRC. Please do not count this article as complete right now.

  • Node.js Design Patterns

    Node.js Design Patterns

    Here I just wanna share my notions and parts I think is important about this book. Please do not consider these article…

    1 条评论

社区洞察

其他会员也浏览了