Using Razor within JavaScript

后端 未结 12 2490
萌比男神i
萌比男神i 2020-11-22 04:12

Is it possible or is there a workaround to use Razor syntax within JavaScript that is in a view (cshtml)?

I am trying to add markers to a Google map...

12条回答
  •  不要未来只要你来
    2020-11-22 05:01

    That will work fine, as long as it's in a CSHTML page and not an external JavaScript file.

    The Razor template engine doesn't care what it's outputting and does not differentiate between

提交回复
热议问题