In the process of developing an Angular markdown editor, I have integrated the ACE editor as a code editor. The npm package for ACE editor can be found here.
You can access a codesandbox version of the project here.
My current challenge involves retrieving the current value of the editor to perform further actions. The goal is to capture the code content whenever it changes with the onChange()
function and store it in an Angular Service.
As part of testing, I aim to display the current content every time there is a change.
this.codeEditor.on("change", function(e) {
const code = this.codeEditor.getValue();
console.log(code);
});
However, I am encountering an error that states:
ERROR TypeError: Cannot read property 'getValue' of undefined
If anyone has faced this issue before, I would appreciate any assistance. I am also open to suggestions on potential alternative approaches to tackle this problem.