Stores and retrieves mat table states (sorting, pagination) with url query params
npm install @nghacks/ngmat-table-query-reflectorStores and retrieves mat table states (sorting, pagination) with url query params
> Install package
``bash`
npm install @nghacks/ngmat-table-query-reflector
> Import NgmatTableQueryReflectorModule to your consumer module.
`typescript
import { NgModule } from '@angular/core';
...
...
import { NgmatTableQueryReflectorModule } from '@nghacks/ngmat-table-query-reflector';
@NgModule({
declarations: [
...
],
imports: [
...
NgmatTableQueryReflectorModule
]
})
export class ConsumerModule { }
`
> Add directive to html template
`html mat-table
[dataSource]="dataSource"
matSort
matSortActive="name"
matSortDirection="desc"
NgMatTableQueryReflector
>
No.
{{element.position}}
Name
{{element.name}}
... ...