停止AngularJS插入LT&;跨度类=" NG-范围">< / SPAN>采用NG-包括: [英] Stop AngularJS inserting <span class="ng-scope"></span> using ng-include

查看:168
本文介绍了停止AngularJS插入LT&;跨度类=" NG-范围">< / SPAN>采用NG-包括:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是基金布局框架,它会自动漂浮 .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:

  • 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屋!

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