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

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -