How passing AngularJS variables to Razor function?

2019-09-15 17:59发布

问题:

it is possible to pass angularjs variable into razor function from Views?

By example, I need to do that things :

@Html.Partial("_ViewName", new Models() { Url = {{ angularJSVariable }} })

It is possible? If yes, how to do that? If no, what is the normal procedure to achieve that from an AngularJS context?

Thank you very much,

Karine

回答1:

You cannot pass anything from javascript to razor without going through the server.

Razor executed in server side and javascript is in client side...for more information check this Question