From f99cb9844f325f43d9fb7ca22394e7ccff89f3b3 Mon Sep 17 00:00:00 2001 From: Amit Moryossef Date: Sun, 16 Apr 2017 11:26:49 +0300 Subject: [PATCH] feat(platform): add dir change event emitter --- src/platform/platform.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/platform/platform.ts b/src/platform/platform.ts index 77d78b346c..d52184e861 100644 --- a/src/platform/platform.ts +++ b/src/platform/platform.ts @@ -50,6 +50,8 @@ export class Platform { private _isPortrait: boolean = null; private _uiEvtOpts = false; + static dirChanged: EventEmitter = new EventEmitter(); + /** @hidden */ zone: NgZone; @@ -313,9 +315,12 @@ export class Platform { * direction needs to be dynamically changed per user/session. * [W3C: Structural markup and right-to-left text in HTML](http://www.w3.org/International/questions/qa-html-dir) * @param {string} dir Examples: `rtl`, `ltr` + * @param {boolean} updateDocument */ setDir(dir: string, updateDocument: boolean) { this._dir = (dir || '').toLowerCase(); + Platform.dirChanged.emit(this._dir); + if (updateDocument !== false) { this._doc['documentElement'].setAttribute('dir', dir); }