I am a beginner to the angular world, I was using the angular material's "Sort header" component, and on the API tab (https://material.angular.io/components/sort/api) there is something called services, and I want to use them, But I don't get it how do to use it.
For example:
On the API tab of "Sort header" or (https://material.angular.io/components/sort/api)
I want to use the service "MatSortHeaderIntl", it has some properties such as - sortDescriptionLabel
So please tell me how to use "sortDescriptionLabel" property of "MatSortHeaderIntl" service.
Thanks.
You need to import, and provide it to your module
import {MatSortHeaderIntl} from '@angular/material';
@NgModule({
imports: [
...
],
entryComponents: [..],
declarations: [...],
bootstrap: [...],
providers: [MatSortHeaderIntl]
})
export class AppModule {}
Then in whatever component you want to use it, instantiate it
constructor( private matSortService: MatSortHeaderIntl) {}
and you can call it by scope
this.matSortService.<method>
I setup an example of Integrated MatSortHeaderIntl Service
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With