@ng4/codemirror

0.0.2 • Public • Published

Angular4 - Codemirror component

npm version Build Status

Установка

npm install @ng4/codemirror --save

Зависимости

{
  "codemirror": "^5.22.2",
  "@angular/common": "^4.0.0",
  "@angular/compiler": "^4.0.0",
  "@angular/core": "^4.0.0",
  "@angular/forms": "^4.0.0"
}

Пример

import {CodemirrorModule} from '@ng4/codemirror';

@NgModule({
  imports:      [
    CodemirrorModule.forRoot()
  ]
})
export class AppModule { }
import {Component} from '@angular/core';

@Component({
  selector: 'sample',
  template: `
    <codemirror [(ngModel)]="code" 
        [config]="{lineNumbers: true}"
        (focus)="onFocus()"
        (blur)="onBlur()">
    </codemirror>
  `
})
export class Sample{
  constructor(){
    this.code = `// Некоторый код...`;
  }
  
  onBlur() { }
  onFocus() { }
}

Конфигурация

config: Объект конфигурации для CodeMirror

MIT License

Package Sidebar

Install

npm i @ng4/codemirror

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • g5