title: How to switch to <html="rtl"> from a component?
body: <p>I'm using Angular 6, and ngx-translate. The only way to switch to rtl without messing the theme is <code>&lt;html dir="rtl"&gt;</code> in index.html.</p>
  
  <p>In <code>component.ts</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>switchLanguage(language: string) {
    this.translate.use(language);
    localStorage.setItem('lang', JSON.stringify(language));
  }
  </code></pre>
  
  <p>How do I add <code>dir="rtl"</code> to <code>&lt;html&gt;</code> if <code>language === "ar"</code>, otherwise remove it? </p>