My code looks like :
$scope.aceIDEs='var hw = new function() {\n console.log("Hello world!");\n}'
$scope.loadAceJSExample = function (_editor) {
_editor.setValue($scope.aceIDEs);
_editor.getSession().setUseWorker(false);
_editor.setHighlightActiveLine(true);
};
And:
<div class="container fade-in" style='padding: 4em;'>
<div>
ui-ace="{onLoad : loadAceJSExample,
onChange : aceJSExampleChanged,
useWrapMode : true,
theme : 'github',
showGutter: true,
mode: 'javascript'
}" />
I tried calling _editor.getSession().removeMarker(); but did not help
Every time i refresh it looks like this,once i click in it returns to normal:
Use _editor.session.setValue($scope.aceIDEs);
which also resets undomanager.
Alternatively you can use _editor.setValue($scope.aceIDEs, cursorPos);
. where cursorPos=-1
puts cursor at start and cursorPos=1
at the end.
Or call _editor.clearSelection()
after setting value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With