回答編集履歴

3

追記

2016/04/20 13:27

投稿

tkanda
tkanda

スコア2425

test CHANGED
@@ -63,3 +63,47 @@
63
63
 
64
64
 
65
65
  ご参考になれば。
66
+
67
+
68
+
69
+ ##修正案
70
+
71
+
72
+
73
+ ```JavaScript
74
+
75
+
76
+
77
+ app.filter('myFilter', function() {
78
+
79
+ return function(list, $scope) {
80
+
81
+ var result = [];
82
+
83
+ list.forEach(function(v) {
84
+
85
+ if (!$scope.chk_on || v.gender === 'female') {
86
+
87
+ result.push(v);
88
+
89
+ }
90
+
91
+ });
92
+
93
+ $scope.num_users = result.length;
94
+
95
+ return result;
96
+
97
+ };
98
+
99
+ });
100
+
101
+ ```
102
+
103
+
104
+
105
+ ```HTML
106
+
107
+ {{num_users}}
108
+
109
+ ```

2

サンプルコード間違い

2016/04/20 13:27

投稿

tkanda
tkanda

スコア2425

test CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ```HTML
12
12
 
13
- <input type='checkbox' ng-click='chk_click' ng-model='chk_on'>Women only
13
+ <input type='checkbox' ng-model='chk_on'>Women only
14
14
 
15
15
  <p ng-repeat="u in users|myFilter:this">{{u.name}}</p>
16
16
 

1

誤記修正

2016/04/20 07:37

投稿

tkanda
tkanda

スコア2425

test CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
 
4
4
 
5
- カスタムフィルを含めたシンプルな例を書きますね。
5
+ カスタムフィルーを含めたシンプルな例を書きますね。
6
6
 
7
7
  (ng-app、ng-controller の定義部分は省略しています。)
8
8