angular2 components for ace editor
npm install angular2-acehtml
`
Usage
`typescript
import { LAceEditorModule } from 'angular2-ace';
@NgModule({
imports: [
BrowserModule,
FormsModule,
LAceEditorModule
],
declarations: [
AppComponent
],
bootstrap: [AppComponent]
})
export class AppModule { }
`
Template
`html
`
Typescript
`typescript
export class AppComponent {
private aceOption: any;
private mode: string = "text";
private editValue: string = "hello";
constructor() {
}
ngOnInit() {
this.aceOption = {
readonly: false,
theme: 'twilight',
onLoaded: (editor) => {
editor.$blockScrolling = Infinity
editor.setOptions({
minLines: 15,
maxLines: 25
})
},
onChange: (e) => {
}
}
}
}
`
Options Define
`typescript
export interface IAceEditorOption {
readonly: boolean;
theme: string;
fontSize: number;
tabSize: number;
enableEmmet: boolean;
enableSnippets: boolean;
showPrintMargin: boolean;
onLoaded: Function;
onChange: Function;
}
``