停止AngularJS插入LT&;跨度类=&QUOT; NG-范围&QUOT;&GT;&LT; / SPAN&GT;采用NG-包括: [英] Stop AngularJS inserting <span class="ng-scope"></span> using ng-include
问题描述
我使用的是基金布局框架,它会自动漂浮 .column
的最后一个兄弟到右边,我真的AP preciate这是一种行为。然而,AngularJS采取它在自身插入 span.ng范围的
后每 div.column
,这在某种程度上会导致浏览器要考虑的最后一个跨度最后兄弟 .column
(即使它是不是)。
I'm using the Foundation layout framework, which automatically floats the last sibling of .column
to the right and I really appreciate this is a behaviour. However, AngularJS takes it upon itself to insert span.ng-scope
after every div.column
, which somehow causes browsers to consider the last span the last sibling of .column
(even though it is not).
在具体基金的CSS负责是这样的:
Specifically the css in Foundation responsible for this is:
[class*="column"] + [class*="column"]:last-child { float: right; }
据我了解, [属性* =串]
应只选择相匹配的,所以兄弟姐妹,针对上述情况,唯一的元素,它的类属性包含列
(包括列
)。我想跨度标签,其类
属性不包含列
不应该匹配(因此通过<被忽略code>:最后一个孩子)。然而,这似乎不是这种情况。
As I understand it, [attribute*="substring"]
should select only siblings that match, so, for the above, only elements whose class attribute contains column
(including columns
). I would think a span tag whose class
attribute that does not contain column
should not match (and thus be ignored by :last-child
). However, this does not seem to be the case.
无论如何,跨度的是的问题引起:
Regardless, the span is causing the problem:
- 角度buggering它(的jsfiddle)
- 无角(相同的jsfiddle工作得很好,没有 NG-包括:)
- Angular buggering it up (jsfiddle)
- Works fine without Angular (same jsfiddle, no ng-include)
有没有配置角度停止插入那些跨度
标签的方法吗?我想,勉强,修改CSS选择器以某种方式忽略所有span标签;然而,我最终可能需要/想使用span标签。
Is there a way to configure angular to stop inserting those span
tags? I would, begrudgingly, modify the css selector to somehow ignore all span tags; however I might eventually need/want to use a span tag.
推荐答案
由于您指定的分区里面可以移动,这个作品:
Since you indicated the div can be moved inside, this works:
<ng-include src="'main.tmpl'"></ng-include>
然后在你的模板:
Then in your template:
<div class="row">
<article id="sidepanels" class="four columns">
...
</div>
我不知道的任何方式prevent从插入span标签角度(我认为它使范围的跟踪这种方式 - 垃圾收集)。
I'm not aware of any way to prevent angular from inserting the span tags (I think it keeps track of scopes that way -- for garbage collection).
这篇关于停止AngularJS插入LT&;跨度类=&QUOT; NG-范围&QUOT;&GT;&LT; / SPAN&GT;采用NG-包括:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!