0

i tried to search on web and knockout's documentation but could not find where and how. Is there event when knockout has updated/added a data on your view?

i need to run some java script after the data has been updated/added by knockout. i don't seem to find a built in event that is triggered when knockout is done doing data updates on the view.

any ideas?

Void Ray
  • 9,849
  • 4
  • 33
  • 53
Justin Homes
  • 3,739
  • 9
  • 49
  • 78

1 Answers1

2

You can explicitly subscribe to an observable:

myViewModel.personName.subscribe(function(newValue) {
    alert("The person's new name is " + newValue);
});

If you need to track changes for all of the observables, check out this post.

To track array changes, check out this post.

Community
  • 1
  • 1
Void Ray
  • 9,849
  • 4
  • 33
  • 53