0.0.2 • Published 8 years ago

@ng4/codemirror v0.0.2

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

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