指令不适用于IE8 [英] Directive not working in IE8
问题描述
我有一个名为barsMax的指令,它在IE8中不起作用,即使我已经放置了:
I have a directive called barsMax and it is not working in IE8, even if I already placed:
<!--[if lte IE 8]>
<script>
document.createElement('bars-max');
</script>
<![endif]-->
我缺少什么?
推荐答案
IE不允许使用不熟悉的标签,因此您不能将指令用作标签。您必须使用限制A并将其用作已知html标记中的属性。如果你不想要包装标签使用replace:true就像这样
IE doesnt allow unfamiliar tags and therefor you may not use directives as tags like . you must use restrict "A" and use it as an attribute in a known html tag. if you dont want the wrapper tag use replace:true like this
返回{
restrict:'A',
replace:true,
范围:...,
链接:...
你可以看到一些关于这里的所有例子 https://skydrive.live.com/redir?resid=949DC4EDBFFD4738!189&authkey=!ABZCTBTTOCDYGhk
工作版本在ie8原生 http://jsbin.com/IDOMuqU/2/edit
(与polyfill原生的ie8中不可用的版本 - http:// jsbin。 com / IDOMuqU / 1 / edit )
working version tested in ie8 native http://jsbin.com/IDOMuqU/2/edit (the not working version in ie8 native with the polyfills - http://jsbin.com/IDOMuqU/1/edit)
这篇关于指令不适用于IE8的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!