C
C#2mo ago
op1511

what is the best way to access the Model object in a razor view, in a javascript?

var model = @Html.Raw(Json.Encode(Model)); ^ is this a good way
3 Replies
op1511
op15112mo ago
or just call directly with fetch?
Angius
Angius2mo ago
Eithet that, or use a dummy element and store it in the data- attributes
op1511
op15112mo ago
ok