如何在angular 7中使用ng2-ace-editor配置[mode] =“'sql'”?

时间:2019-04-17 04:10:15

标签: javascript angular ace-editor

当我使用ng2-ace-editor时。有配置

<div ace-editor
       [(text)]="text"
       [mode]="'sql'"
       [theme]="'eclipse'"
       [options]="options"
       [readOnly]="false"
       [autoUpdateContent]="true" 
       [durationBeforeCallback]="1000"
       (textChanged)="onChange($event)"
       style="min-height: 20px; max-height: 20px; width:100%; overflow: auto;"></div>

但是有console.log

http://localhost:4200/mode-sql.js net::ERR_ABORTED 404 (Not Found)
http://localhost:4200/mode-html.js net::ERR_ABORTED 404 (Not Found)

如何在ng2-ace-editor中配置模式?

1 个答案:

答案 0 :(得分:0)

您需要导入在编辑器中使用的必需modes/themes

将此代码放在使用Ace editor的组件中,然后重试:

import 'brace';
import 'brace/mode/sql';