Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. function conc(x, y_theoretical, y_measured) {
  2. var self = this;
  3. self.x = ko.observable(x);
  4. self.y_t = ko.observable(y_theoretical);
  5. self.y_m = ko.observable(y_measured);
  6.  
  7. function ConcentrationViewModel() {
  8.  
  9. var self = this;
  10.  
  11. self.concentrations = ko.observableArray([
  12. new conc(2, 9, 8),
  13. new conc(6, 10, 11),
  14. new conc(8, 12, 13),
  15. new conc(10, 14, 15),
  16. new conc(14, 16, 17),
  17. new conc(19, 18, 19)
  18. ]);
  19.  
  20. self.a = ko.computed(function() {
  21. var res = self.concentrations[0].x + self.concentrations[1].x;
  22. return res;
  23. },this);
  24.  
  25. self.b = ko.computed(function() {
  26. return 15;
  27. },this);
  28.  
  29. debugger;
  30. ko.applyBindings(new ConcentrationViewModel());
  31. debugger;
  32.  
  33. var value = self.myObservableProperty();
  34.  
  35. self.myObservableProperty(newValue);
  36.  
  37. self.a = ko.computed(function(){
  38. var allConcentrations = self.concentrations();
  39. return allConcentrations[0].x() + allConcentrations[1].x();
  40. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement