How can I correctly write this MVC razor code to work with my javascript?

I use the following code with the idea of ​​outputting model values ​​to script tags on my page. I am trying to use a razor viewer mechanism. It actually seems to work, but Visual Studio doesn't seem to like it all for the green squiggles in all of my code. How can I do what I am going to do right here. Thanks for any help.

@model RepairInformation.Web.ViewModels.MaintenanceViewModel

<div id="tabs"> @{  Html.RenderPartial("_tabs");  }  </div>
<script src='@Url.Content("~/Scripts/addressHelper.js")' type="text/javascript">     </script>
<script type="text/javascript">

  (function ($) {

      $(document).ready(function () {

        if (typeof selectedVehicle != 'undefined') {
            selectedVehicle = new $repairInfo.Vehicle(@Model.CurrentVehicle.Vid ,   @Model.CurrentVehicle.Year, '@Model.CurrentVehicle.Make', '@Model.CurrentVehicle.Model'); 
            debugger;
        }
    });
})(jQuery);

</script>

Please let me know how to do this correctly.

Thank you
~ ck in San Diego

+3
source share
1 answer

. ? , Visual Studio Javascript - @Model... ( Javascript, html).

+3

Source: https://habr.com/ru/post/1780718/


All Articles