viv*_*pta 3 javascript web angular
我是角度世界的初学者,我使用的是角度材料的“排序标头”组件,在 API 选项卡(https://material.angular.io/components/sort/api)上有一个叫做服务的东西,并且我想使用它们,但我不明白如何使用它。
例如:
在“排序标题”的 API 选项卡上或(https://material.angular.io/components/sort/api)
我想使用“MatSortHeaderIntl”服务,它有一些属性,例如 - sortDescriptionLabel
所以请告诉我如何使用“MatSortHeaderIntl”服务的“sortDescriptionLabel”属性。
谢谢。
您需要导入并将其提供给您的模块
import {MatSortHeaderIntl} from '@angular/material';
@NgModule({
imports: [
...
],
entryComponents: [..],
declarations: [...],
bootstrap: [...],
providers: [MatSortHeaderIntl]
})
export class AppModule {}
Run Code Online (Sandbox Code Playgroud)
然后在你想使用它的任何组件中,实例化它
constructor( private matSortService: MatSortHeaderIntl) {}
Run Code Online (Sandbox Code Playgroud)
你可以按范围调用它
this.matSortService.<method>
Run Code Online (Sandbox Code Playgroud)
我设置了一个集成 MatSortHeaderIntl 服务的例子
| 归档时间: |
|
| 查看次数: |
1610 次 |
| 最近记录: |