Jules Wensley
Jules Wensley

Reputation: 111

Mvc3 Model with KnockoutJs ViewModel

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

Answers (1)

veblock
veblock

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

Related Questions