how to delete the content of ace editor on a valid

2019-07-04 10:14发布

问题:

My question is related to set focus on ace editor

This time I want to delete the content whenever there is a validation error.

I have the used the pattern like

/^[0-4]$/ and /^([1-9][0-9]{0,3}|[1-5][0-9]{4}|60000)$/;

to check the value between 0-4 and 1-60000 respectively. When user provides invalid data my text area is cleared but not the ace editor. I also tried

    $scope.close = function () {
rowObj.entity.value = editor.getValue();
            editor.setValue("",0);
                };

but that is not working.

回答1:

to clear editor simply call editor.setValue("")



标签: ace-editor