12
在JavaScript中使用Razor
是否可以解决在视图(cshtml)中的JavaScript中使用Razor语法的问题? 我正在尝试向Google地图添加标记...例如,我尝试了此操作,但是却遇到了大量的编译错误: <script type="text/javascript"> // Some JavaScript code here to display map, etc. // Now add markers @foreach (var item in Model) { var markerlatLng = new google.maps.LatLng(@(Model.Latitude), @(Model.Longitude)); var title = '@(Model.Title)'; var description = '@(Model.Description)'; var contentString = '<h3>' + title + '</h3>' + '<p>' + description + …