How do you get current direction for locales?
In Angular 9.1, the API method getLocaleDirection
can be used to get the current direction in your app. This method is useful to support Right to Left locales for your Internationalization based applications.
import { getLocaleDirection, registerLocaleData } from '@angular/common';import { LOCALE_ID } from '@angular/core';import localeAr from '@angular/common/locales/ar';...constructor(@Inject(LOCALE_ID) locale) {const directionForLocale = getLocaleDirection(locale); // Returns 'rtl' or 'ltr' based on the current localeregisterLocaleData(localeAr, 'ar-ae');const direction = getLocaleDirection('ar-ae'); // Returns 'rtl'// Current direction is used to provide conditional logic here}
May 31, 2022
431
Read more
What is Angular Framework?
November 04, 2022
AngularWhat is a Angular module?
November 03, 2022
AngularWhat are the steps to use animation module?
October 31, 2022
Angular