Reputation: 111
I'm trying to find out how i can pass an Mvc 3 model (with pre-populated collections) to a Knockout ViewModel?
Any ideas?
Thanks in advance for your help.
Jules
Upvotes: 3
Views: 1566
Reputation: 1924
You can just populate it from your Razor view by writing all the mvc model values into related js objects. But I would rather load it via Ajax call after the page is loaded. Have a look at an idea here: Lazy loading an observable in KnockoutJS.
Upvotes: 1