Skip to content

nickiannone/ng4-codemirror

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Angular4 and Codemirror

Resources

License

Stars

Watchers

Forks

Packages

No packages published