title: Set Ace Editor to Read Only
body: <p>I am having trouble setting my ace-editor to read only mode. I am using angular 9 and have tried the following approach:</p>
  <p>In the HTML file I have:</p>
  <pre><code> &lt;ace-editor mode=&quot;java&quot; theme=&quot;monokai&quot; id=&quot;codeEditor&quot;&gt;&lt;/ace-editor&gt;
  </code></pre>
  <p>In my typescript file, I have:</p>
  <pre><code>import * as ace from 'ace-builds/src-noconflict/ace';
  
  ... 
  
  ngOnInit() {
      var editor = ace.edit('codeEditor');
      editor.getSession().setUseWorker(false);
      editor.setShowPrintMargin(false);
      editor.setReadOnly(true);
  }
  </code></pre>
  <p>However, when the template loads, I am still able to write code in my ace editor.</p>