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

Can't see directive's scope when embedded in a custom directive #114

Open jrwilliams opened 8 years ago

jrwilliams commented 8 years ago

I'd like to use a ui-codemirror directive inside my own custom directive, but it appears that it cannot see the directive's scope - I'm trying to define the options for the codemirror block.

Plnkr here: http://plnkr.co/edit/QdJoF8WxW3r4bzXEYfNe?p=preview Notice that the first codemirror block doesn't have line numbers because it can't see the options2 object defined on the directive's scope.

Is this a bug? Maybe I'm misusing/misunderstanding directive scoping?

rohullah-ayoub commented 8 years ago

I think the problem here is that codemirror directive inside your custom directive is not being compiled. This can be solved by using the compile function inside your directive.

Modified example of your code here: http://plnkr.co/edit/UzWIA4IHdx2r4MYTDV5D?p=preview