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

Made ui-codemirror work with updateOn: 'blur' #104

Open jasonreich opened 9 years ago

jasonreich commented 9 years ago

Adjusted slightly to respect "updateOn" ngModelOption attributes. Previously, if one specified {updateOn: 'blur'}, the model would never update.

The specific changes are;

  1. A modification of `src/ui-codemirror.js' to add the necessary debounce and commit code (follows that in angular's ngmodel directive).
  2. An additional unit test for the {updateOn: 'blur'} case.
floribon commented 8 years ago

+1 this is really needed, has uiCodemirror development being abandoned?

boutils commented 7 years ago

Workaround here:

$scope.editorOptions = {
    onLoad: function(editor) {
        editor.on('blur', function() {
            $scope.myModel = editor.getValue();
        })
    }
}