Set Up An Angular 8 Project With Material and NGXS - Reader Mode
Set Up An Angular 8 Project With Material and NGXS - Reader Mode
In this article, I will show you how to set up a full Angular project.
For those who are new to Angular, the Angular CLI is a command-line
interface tool that you use to initialize, develop, scaffold, and maintain
Angular applications.
For those who want to upgrade the angular-cli to the current version 8,
run the following commands:
This command means that it veri es the contents of the cache folder,
garbage collecting any unneeded data, and verifying the integrity of
the cache index and all cached data.
ng new project-name
If you pick scss for your style and your company has a proxy, then
you need to run one more command
To install Angular Material is quite easy. From this guide you just need
to run:
ng add @angular/material
In this example, I do not pick any theme, I selected custom option, and
install both HammerJS and Browser animations.
So, I will create one shared Angular module and put all Angular
Material modules that I need into it. Then I import it into my app as
needed.
Then, we will put all the material modules that we need into that
material module.
MaterialModule
To install:
npm i -s @angular/flex-layout
After installation, you just import it into your shared module and use
it. To me, I put it into material module because I will use this one
together with material components.
Now, you can use the Angular Layout attributes in your HTML tags for
ex layout.
Check out all of the available options for using Angular Layout in your
application.
There are some options to pick for state management such as NGRX,
NGXS, or using Rxjs to manage data in your application.
This command will install the store and 2 plugins into your angular
application.
Second, create the store module to con gure it for your application:
store.module.ts
Now you can create your state and action. Then, put the state le
inside the NgxsModule.
Summary
I hope you found this article useful! You can reach me at my website.
Feel free to leave any questions in the comments below. I’ll be glad to
help out!