angular2-ace

0.0.3 • Public • Published

angular2-ace

angular2 components for ace editor

Required

<script src="//cdn.bootcss.com/ace/1.2.5/ace.js"></script>

Usage

import { LAceEditorModule } from 'angular2-ace';
 
@NgModule({
  imports: [
    BrowserModule,
    FormsModule,
    LAceEditorModule
  ],
  declarations: [
    AppComponent
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Template

<l-ace-editor [mode]="mode" [options]="aceOption" [(ngModel)]="editValue"></l-ace-editor>

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

export interface IAceEditorOption {
  readonly: boolean;
  theme: string;
  fontSize: number;  
  tabSize: number;
  enableEmmet: boolean;
  enableSnippets: boolean;
  showPrintMargin: boolean;
  onLoaded: Function;
  onChange: Function;
}

Readme

Keywords

none

Package Sidebar

Install

npm i angular2-ace

Weekly Downloads

4

Version

0.0.3

License

MIT

Last publish

Collaborators

  • dove2580