Ui-codemirror placed in user directives fails without errors

I am trying to use the ui-codemirror angular directive from the code mirror angular library , and the use case is that I have to put it in a custom directive.

But when I put it in a custom directive, I cannot see the code mirror in the text area. infact, the text area becomes unavailable for editing.

But when I place it outside of the user directive, it works as expected.

I am attaching a violin code for this http://plnkr.co/edit/NVFuumrGq2FJ8d8EC8Xn?p=preview , I don’t even have the ability to debug, as there isn’t even an error. Failed to conclude if this is an error. Please help me.

Last Updated (January 17, 2014) -

I posted the same as the problem in mirroring the git hub repo code. The person working on it confirmed that this is a mistake, and that he is not going to correct it yet. So we can try workarounds. see https://github.com/angular-ui/ui-codemirror/issues/36#issuecomment-31925751

+5
angularjs angularjs-directive angular-ui codemirror
source share
1 answer

Here you go, I fixed it for you:

This is not a bug with a code mirror or a bug with AngularJS. Since the release of 1.20 child nodes, which exists in a compiled directive that has an isolation scope, no longer inherits the new scope, since they were already assigned to the parent scope (I know this is confusing), but in this case you had to translate the existing code using the linker function in the directive.

Here you go: http://plnkr.co/edit/MaIpdJsPE6qpYqR8BJtQ?p=preview

+1
source share

All Articles