Angular 根据区域设置设置html目录属性

Angular 根据区域设置设置html目录属性,angular,angular-i18n,Angular,Angular I18n,将angular.json的build config中的i18n locale设置为类似希伯来语的RTL语言,不会将html的dir属性更改为RTL。是否有其他方法可以根据区域设置自动设置html或bodydir属性?AppComponent应按如下方式侦听语言更改: app.component.ts @组件(…) 导出类AppComponent{ 公共目录:字符串; 构造函数(私有翻译:翻译服务){ translate.onLangChange.subscribe(x=>this.dir=x

将angular.json的build config中的i18n locale设置为类似希伯来语的RTL语言,不会将html的dir属性更改为RTL。是否有其他方法可以根据区域设置自动设置html或body
dir
属性?

AppComponent应按如下方式侦听语言更改:

app.component.ts

@组件(…)
导出类AppComponent{
公共目录:字符串;
构造函数(私有翻译:翻译服务){
translate.onLangChange.subscribe(x=>this.dir=x==“en”?“ltr”:“rtl”)
}
}
app.component.html: