Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'match' of undefined #2

Open
AntonioStipic opened this issue Jul 6, 2017 · 3 comments
Open

Cannot read property 'match' of undefined #2

AntonioStipic opened this issue Jul 6, 2017 · 3 comments

Comments

@AntonioStipic
Copy link

I installed ace-angular with npm and created ace editor inside angular, it looks like this:

[HTML]
<div id="editor" ace-editor="aceOptions" ng-model="aceContent"></div>

[JS]
$scope.aceOptions = {
    method: "javascript",
    theme: "monokai",
    onLoad: function(editor, session, ace){
        // Do on load
    }
}

And it keeps saying "TypeError: Cannot read property 'match' of undefined" every time I load page with ace editor. Screenshot:
http://imgur.com/jFsG1KP

[AngularJS]
var app = angular.module("cloude", ["ngRoute", "ace.angular"]);

It seems that error will not appear if I remove "ace.angular" so I guess it is problem with module?

@jayralencar
Copy link
Owner

Can you share a example in https://jsfiddle.net/?

@nickjgentile
Copy link

I get this error any time we init an instance of ace-editor. It doesn't seem to cause problems for our users but it is an error. Seems to happen on this function's match.
this.$detectNewLine = function(e) { var t = e.match(/^.*?(\r\n|\r|\n)/m); this.$autoNewLine = t ? t[1] : "\n", this._signal("changeNewLineMode") }

Here's an example of how we init:
<div class="form-control" style="height: 400px;" ace-editor="{ mode: 'json', onLoad: aceLoaded, require: ['ace/ext/language_tools'], advanced: { enableSnippets: true, enableBasicAutocompletion: true, enableLiveAutocompletion: true }}" ng-model="data"> </div>

@edswangren
Copy link

A bit old, but my guess is that data isn't initialize when the editor is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants