回答編集履歴
1
サンプルコードの誤記修正
answer
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
```JavaScript
|
6
6
|
app.filter("myfilter", function() {
|
7
|
-
return function(value, index) {
|
7
|
+
return function(value, index, $scope) {
|
8
8
|
$scope.data = $scope.data || {};
|
9
9
|
$scope.data[index] = value;
|
10
10
|
return value;
|
@@ -13,7 +13,7 @@
|
|
13
13
|
```
|
14
14
|
|
15
15
|
```HTML
|
16
|
-
<p ng-repeat="item in items" ng-bind="item.value|myfilter:$index"></p>
|
16
|
+
<p ng-repeat="item in items" ng-bind="item.value|myfilter:$index:this"></p>
|
17
17
|
```
|
18
18
|
|
19
19
|
こんな感じに書くことができます。
|