Sunday, 15 February 2015

javascript - How can I retrieve my action parameters from controller action into Knockout VM -



javascript - How can I retrieve my action parameters from controller action into Knockout VM -

this controller action...

// get: ex: /question/details/5?project=1 public actionresult details(int? project, int? questionid) { ... }

this knockout vm:

// other info question $(document).ready(function () { getsomeotherinfo(<need pass question id here>, <need pass project id here>); });

any help appreciated.

if using typed viewmodel details, can add together 2 properties view model, in view provide values javascript:

$(document).ready(function () { getsomeotherinfo(@(model.project), @(model.questionid)); });

if not using typed viewmodel, can utilize viewbag

javascript asp.net-mvc knockout.js

No comments:

Post a Comment