Question

I´m using knockout for translate my phonegap APP, knockout is not working when I use "load" function.

For example:

$('#menu').load('./includes/inc-menu.html');
ko.applyBindings(new AppViewModel());

The content in inc-menu.html isnt translate and the code without load yes.

How can I solve it?

Was it helpful?

Solution

I have not tried below script, but my guess is that you need to apply binding after content is loaded.

$('#menu').load('./includes/inc-menu.html', function(){
    ko.applyBindings(new AppViewModel(), $(#menu)[0]); // apply bindings only to element with id as menu
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top