feat(platform): add dir change event emitter

This commit is contained in:
Amit Moryossef
2017-04-16 11:26:49 +03:00
parent 90de5d1105
commit f99cb9844f

View File

@@ -50,6 +50,8 @@ export class Platform {
private _isPortrait: boolean = null;
private _uiEvtOpts = false;
static dirChanged: EventEmitter<any> = 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);
}