NbLayoutDirectionService: Cannot read properties of null (reading 'setAttribute')
- 主要语言
- TypeScript
- 星标
- 8.1k
- 派生
- 1.5k
- PR 合并指标
- 30 天内没有已合并 PR
描述
NbLayoutDirectionService throws error on second direction change.
The error doesn't appear when changing the direction for the first time
```
ERROR TypeError: Cannot read properties of null (reading 'setAttribute')
at OverlayRef._updateElementDirection (overlay-module-6629f4c6.mjs:1171:16)
at OverlayRef.setDirection (overlay-module-6629f4c6.mjs:1133:10)
at Object.next (nebular-theme.mjs:4169:74)
at ConsumerObserver2.next (Subscriber.js:90:25)
at Subscriber2._next (Subscriber.js:59:22)
at Subscriber2.next (Subscriber.js:32:12)
at Subject.js:41:22
at errorContext (errorContext.js:23:5)
at Subject2.next (Subject.js:31:5)
at Object.next (share.js:57:25)
```
@nebular/theme: 15.0.0
```typescript
setAppLanguage() {
const language =
this.currentUserProfile?.preferred_langcode ||
navigator.language.split('-')[0] ||
'en';
this.translateService.use(language);
const direction =
language === 'en' ? NbLayoutDirection.LTR : NbLayoutDirection.RTL;
this.layoutDirectionService.setDirection(direction);
}
```
贡献指南
评估
这个 Issue 还没有评估数据。