I am trying to change my layout dynamically according to the user's language choice and switch from LTR to RTL on the fly.
I am using Angular 2 rc6, material 2.0.0-alpha.9-3
It looks like when the page is loaded, it works fine with rtl or ltr. However, when it dynamically changed from the application (see Plunker), the direction changes, but the generated md-sidenav-content element has calculated margins to the right and left of the field.
Digging further, I was able to see that the _dir object has an eventEmitter, which should monitor _dir change events and recount the fields
@ angular / material / sidenav / sidenav.js:
_dir.dirChange.subscribe(function () { return _this._validateDrawers(); });
But it was never called during a dynamic change of direction. Although, _dir has the correct meaning when a page loads for the first time, be it ltr or rtl.
Finally, here is the behavior plunker:
http://plnkr.co/edit/o8lXWC?p=preview
I suspect that I am not using _dir correctly, but I have not been able to figure out how to do it correctly.
source
share