Closed captainkovalsky closed 9 years ago
I've found workaround
$scope.formatCode = function() {
try {
var val = _editor.session.getValue();
var o = JSON.parse(val);
val = JSON.stringify(o, null, '\t');
_editor.session.setValue(val);
} catch (e) {
console.log('something wrong with your json.');
return; //show message that json is malformed
}
};
I've included ace and it works fine. I want to reformat code manually, has ui-ace this possibility?
I've found this soulution http://stackoverflow.com/a/11101769/1115430 But it doesn't work, here is used code