放在定制指令内用户界面 - codeMIRROR失败,没有一个错误 [英] ui-codemirror placed within custom directives fails without an error

查看:127
本文介绍了放在定制指令内用户界面 - codeMIRROR失败,没有一个错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用用户界面 - codeMIRROR角指令从的 code镜角库和用例是,我必须把它放在一个自定义指令中。

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

但是,当我把它放在一个自定义的指令中,我无法看到在文本区域的code镜像。逸岸文本区域变得不可编辑。

But when I place it within a custom directive I am unable to see the code mirror in the text area. infact the text area becomes non editable .

但是,当我把它,它工作正常。自定义指令之外

But when I place it outside the custom directive it works as expected .

我附上小提琴code这个的http:// plnkr。 CO /编辑/ NVFuumrGq2FJ8d8EC8Xn?p = preVIEW
。我别无选择,即使调试,因为竟然没有一个错误。
无法断定是否是bug.Please指导我。

I am attaching the fiddle code for this http://plnkr.co/edit/NVFuumrGq2FJ8d8EC8Xn?p=preview . I have no option to even debug since there is not even an error . Unable to conclude if it is a bug.Please guide me .

最新(2014年1月17日) -

我贴的一样,在code镜混帐枢纽回购的问题。它的工作的人证实,这是一个错误,他是不会解决它现在。所以可能我们应该设法解决方法。
请参阅: https://github.com/angular- UI /用户界面 - codeMIRROR /问题/ 36#issuecomment-31925751

I posted the same as an issue in the code mirror git hub repo . The person working on it confirmed that it is a bug and that he is not going to fix it for now . So may we should try workarounds . see : https://github.com/angular-ui/ui-codemirror/issues/36#issuecomment-31925751

推荐答案

在这里,你走我已经固定它给你:

Here you go I've fixed it for you:

这是不是与code镜或AngularJS错误的bug。由于具有一个ISOLITE范围不再继承新范围,因为它们已被分配给父范围已编译指令中存在1.20的子节点的释放(我知道它的混淆),但在这种情况下,需要transclude现有使用该指令链接功能code镜的内容。

This is not a bug with code mirror or a bug with AngularJS. Since the release of 1.20 child nodes that exists within a compiled directive that has an isolite scope no longer inherit the new scope as they have already be assigned to the parent scope (I know it's confusing) but in this case you needed to transclude the existing code mirror content using the linker function in the directive.

在这里你去:
http://plnkr.co/edit/MaIpdJsPE6qpYqR8BJtQ?p=$p$pview

这篇关于放在定制指令内用户界面 - codeMIRROR失败,没有一个错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆