Angular4 - Codemirror component
Установка
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