javascript - CodeMirror going into infinite loop when implementing on change function -
javascript - CodeMirror going into infinite loop when implementing on change function -
i need track alter in codemirror editor. implemented:
codemirrorinstance.on("change", function(codemirrorinstance){ $scope.onchangefunc(codemirrorinstance); } );
in onchangefunc
insert based on status new value using
codemirrorinstance.setvalue(newcode);
apparently leads infinite loop. how break vicious circle?
setvalue
trigger "change"
event (it changes content, after all). you'll have create alter handler clever plenty not cause additional changes changes caused. looking @ origin
property of sec argument passed "change"
event handler might work -- contains sting identifies source of change, "setvalue"
when setvalue
called.
javascript angularjs codemirror
Comments
Post a Comment