angular-ui / ui-codemirror

This directive allows you to add CodeMirror to your textarea elements.
http://angular-ui.github.io/ui-codemirror
MIT License
378 stars 193 forks source link

How i can get value from ui-codemirror? #125

Closed olaferlandsen closed 7 years ago

olaferlandsen commented 8 years ago

Well, i use this obviously used it with AngularJS with coffee. So, how i can get value from it?

My controller :

.controller('EditorCtrl', [
    '$scope'
    ($scope) ->
        $scope.codemirrorLoaded = (_editor) ->
            _doc = _editor.getDoc();
            _editor.focus();
            _editor.setOption('lineWrapping', true);
            _editor.setOption('lineNumbers', true);
            _editor.setOption('mode', 'javascript');
            _doc.markClean()
])

My view:

<div ui-codemirror="{ onLoad : codemirrorLoaded }"></div>

Thanks