A fork from ng2-ace-editor updated to work with Angular 9
npm install ngx-ace-editor-wrapper
Ace editor integration with typescript for angular 5.
To use Angular 4 install version 0.3.1 (npm i -S ngx-ace-editor-wrapper@0.3.1).
npm i -S ngx-ace-editor-wrapper##### Load the module for your app:
``javascript
import { AceEditorModule } from 'ngx-ace-editor-wrapper';
@NgModule({
...
imports: [
...
AceEditorModule
]
})
`
> Minimal
`js
//import { AceEditorModule } from 'ngx-ace-editor-wrapper';
import { Component } from '@angular/core';
@Component({
template:
})
export class MyComponent {
text:string = "";
}
`> Complete
`js
import { Component } from '@angular/core';//to use theme "eclipse"
//with angular-cli add "../node_modules/ace-builds/src-min/ace.js"
//and "../node_modules/ace-builds/src-min/theme-eclipse.js" to "scripts" var into the file angular-cli.json
@Component({
template:
})
export class MyComponent {
text:string = "";
options:any = {maxLines: 1000, printMargin: false};
onChange(code) {
console.log("new code", code);
}
}
`Use Component
`js
import {Component, ViewChild} from '@angular/core';//to use theme eclipse
//with angular-cli add "../node_modules/ace-builds/src-min/ace.js"
//and "../node_modules/ace-builds/src-min/theme-eclipse.js" to "scripts" var into the file angular-cli.json
@Component({
template:
})
export class AceCmp {
@ViewChild('editor') editor;
text: string = ""; ngAfterViewInit() {
this.editor.setTheme("eclipse");
this.editor.getEditor().setOptions({
enableBasicAutocompletion: true
});
this.editor.getEditor().commands.addCommand({
name: "showOtherCompletions",
bindKey: "Ctrl-.",
exec: function (editor) {
}
})
}
}
``