如何在验证错误时删除ace编辑器的内容 [英] how to delete the content of ace editor on a validation error

查看:73
本文介绍了如何在验证错误时删除ace编辑器的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与将重点放在ace编辑器上

这一次我想在出现验证错误时删除内容。

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

我使用过类似的模式

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

分别检查0-4和1-60000之间的值。当用户提供无效数据时,将清除我的文本区域,但不会清除ace编辑器。我也尝试过

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);
                };

但这不起作用。

推荐答案

要清除编辑器,只需调用 editor.setValue()

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

这篇关于如何在验证错误时删除ace编辑器的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆