首页 > 解决方案 > ng重复索引不适用于jade mixin

问题描述

我将angularJS 1.5.8ng-repeat 与一组搜索数据一起使用。我试图$index在 ng-repeat 中传递 on mixin。它显示为空。当我通过控制器内部的 $scope 声明变量对象并传递给 Mixin 时,它与变量一起工作,但$index没有。

ul
 li(ng-repeat='p in searchData')
   span
    | Before Mixin: $index
   +AddItem($index)

米信

mixin AddItem($index)
  span
   | Inside Mixin: {{ $index }}

输出

Before Mixin: 0
Inside Mixin:
Before Mixin: 1
Inside Mixin:

标签: angularjspug

解决方案


推荐阅读