ng2-codemirror

WebJar for ng2-codemirror

License

License

MIT
Categories

Categories

Mirror Application Layer Libs Introspection
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

ng2-codemirror
Last Version

Last Version

1.1.3
Release Date

Release Date

Type

Type

jar
Description

Description

ng2-codemirror
WebJar for ng2-codemirror
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/chymz/ng2-codemirror

Download ng2-codemirror

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/ng2-codemirror/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>ng2-codemirror</artifactId>
    <version>1.1.3</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/ng2-codemirror/
implementation 'org.webjars.npm:ng2-codemirror:1.1.3'
// https://jarcasting.com/artifacts/org.webjars.npm/ng2-codemirror/
implementation ("org.webjars.npm:ng2-codemirror:1.1.3")
'org.webjars.npm:ng2-codemirror:jar:1.1.3'
<dependency org="org.webjars.npm" name="ng2-codemirror" rev="1.1.3">
  <artifact name="ng2-codemirror" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='ng2-codemirror', version='1.1.3')
)
libraryDependencies += "org.webjars.npm" % "ng2-codemirror" % "1.1.3"
[org.webjars.npm/ng2-codemirror "1.1.3"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : codemirror jar [5.22.2,6)

Project Modules

There are no modules declared in this project.

Angular - Codemirror component

Use the CodeMirror (5.x) code editor in your Angular application.

Demo : https://embed.plnkr.co/8e9gxss9u10VeFrv29Zt/

Installation

  • Include Codemirror javascript files in your application (with files for modes)
  • Install ng2-codemirror
    • JSPM : jspm install npm:ng2-codemirror
    • NPM : npm install ng2-codemirror

Dependencies

CodeMirror library is required for this component :

  • Install via NPM : npm install codemirror
  • Install via JSPM : jspm install npm:codemirror

CodeMirror need to be accessible by import 'codemirror'

Then you need to include base CSS of codemirror located in codemirror/lib/codemirror.css

Sample

Include CodemirrorModule in your main module :

import { CodemirrorModule } from 'ng2-codemirror';

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

@Component({
  selector: 'sample',
  template: `
    <codemirror [(ngModel)]="code"
      [config]="{...}"
      (focus)="onFocus()"
      (blur)="onBlur()">
    </codemirror>
  `
})
export class Sample{
  constructor(){
    this.code = `// Some code...`;
  }
}

Configuration

Licence

See LICENSE file

Versions

Version
1.1.3