Reputation: 77
Bit of a newbie to MVC, when I try to access my username property of my viewmodel, I get a syntax error.
@section scripts {
<script type="text/javascript">
var userName = @Model.UserName;
</script>
}
Upvotes: 1
Views: 211
Reputation: 553
This is a known issue: actually Visual Studio thinks there is syntax error but there's not! You've got some solutions:
var userName = "@Model.UserName"
Upvotes: 1