ng2-codemirror icon indicating copy to clipboard operation
ng2-codemirror copied to clipboard

Accessing CodeMirror.Pos?

Open ghost opened this issue 8 years ago • 2 comments

Within my angular component, how do I go about accessing CodeMirror methods such as CodeMirror.Pos() - similar to whats found in anyword-hint.js?

ghost avatar Jun 06 '17 21:06 ghost

Did you try this :

import { Component, ViewChild } from '@angular/core';

@Component({
  selector: 'my-app',
  template: `<codemirror #editor></codemirror>`
})
export class AppComponent {

  @ViewChild('editor') editor:any;

  ngOnInit() {
    console.log(this.editor.instance);
  }

}

yabab-dev avatar Jun 23 '17 09:06 yabab-dev

The only correction is that it should be ngAfterViewInit(). Otherwise @ViewChild is not initialized.

opensso avatar Jul 19 '17 23:07 opensso