Changing mode for (ng2-)codemirror in Angular 2

痴心易碎 提交于 2019-12-05 15:56:46

Okay, I just managed to make it work, you need to do the following:

  1. Add <script src="node_modules/codemirror/lib/codemirror.js"></script> to index.html (thanks a lot @PierreDuc)
  2. Import mode you want to use in your component, in my case it was clike mode:

    import 'codemirror/mode/clike/clike';

If using angular-cli you only need to add the file(s) to angluar-cli.json and do the import in your component. No need to add the script to index.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!