javascript - Angular and code mirror -
I'm trying to add some attributes to the javascript
tool, and highlight me One line in the requirement is codemirror
. I am using AngularJs
first I tried to follow a tutorial
function highlights line (line number) {// line number is zero-based index Var real line = line number - 1; // DOM var myEditor = $ (select the editor loaded in "# body_EditorSource .CodeMirror"); // Write the item in the console window for debugging console.log (myEditor); // Choose the first item (Zero index) and found more than one & amp; Get the CodeMirrorJar object var codeMirrorEditor = myEditor [0] .odeMirror; // debugging console. Type the item in the console in the console window (My Editor [0] .CodeMirror); // Set Line CSS class on line number & amp; Impact the background of the line with the CSS class of the line-error code. MirrorEditor.Setline Class (actual linum, 'background', 'line-error'); }
but it does not work, detects myEditor var
... I've tried:
Var myEditor = document.getElementById ('codeMirrorDiv'); Var myEditor = angular.element (document.querySelector ((". CodeMirrorDiv")));
And what does not seem to be anything else?
function is called
Comments
Post a Comment