Reputation: 12727
The following .html
snippet retrieves the value of a ko observable named title
:
<th data-bind="text: title"></th>
Only knowing the .html
file, is there a way to systematically find out (backtrace?), where - in which .js
file of the project - this specific title
observable is being created initially?
If so, how can this be achieved?
Knockout 3.4.2
Upvotes: 0
Views: 231
Reputation: 5115
Assuming you can run the project, you could try the following steps (example uses Chrome browser):
Find the dom element bound to the observable:
Find some knockout context for this element to spot the viewmodel containing the observable
ko.contextFor(document.querySelector('<paste element selector>'))
$data
(currently bound viewmodel) or any of the $parents
(in case of foreach-es...) to find the viemodel name containing the observableFind the javascript file containing the viewmodel:
In the results window, you'll find all files containing this viewmodel name (and the declaration of the observable).
Upvotes: 1