Justin Homes
Justin Homes

Reputation: 3799

Knockout Event on data bind update/add of view

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?

Upvotes: 0

Views: 67

Answers (1)

Void Ray
Void Ray

Reputation: 10219

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.

Upvotes: 2

Related Questions