回答編集履歴

2

気がついた点を追記

2015/10/17 13:15

投稿

hiroshitoda
hiroshitoda

スコア12

test CHANGED
@@ -1,4 +1,22 @@
1
+ 元のコードをよく読んでいましたが、aとbがバインディングされたViewModelのメンバーになっておらず、undefined variableエラーで落ちているんじゃないでしょうか。
2
+
3
+ 例えば、ViewModel側に次のようなコードが無いのではないか、ということです。
4
+
5
+
6
+
7
+ ```JavaScript
8
+
9
+ this.a = 'foo';
10
+
11
+ this.b = 'bar';
12
+
13
+ ```
14
+
15
+
16
+
17
+
18
+
1
- このくらいの処理であれば、もうバインディング記述ではなくViewModelに書いた方が良いのではないでしょうか。
19
+ また、このくらいの処理であれば、もうバインディング記述ではなくViewModelに書いた方が良いのではないでしょうか。
2
20
 
3
21
 
4
22
 

1

var self = this; を前提としていた記述を修正しました。

2015/10/17 13:15

投稿

hiroshitoda
hiroshitoda

スコア12

test CHANGED
@@ -42,6 +42,6 @@
42
42
 
43
43
  }
44
44
 
45
- self.computedClass = ko.computed(computedClassImpl);
45
+ this.computedClass = ko.computed(computedClassImpl);
46
46
 
47
47
  ```