C
C#10mo 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
op1511OP10mo ago
or just call directly with fetch?
Angius
Angius10mo ago
Eithet that, or use a dummy element and store it in the data- attributes
op1511
op1511OP10mo ago
ok

Did you find this page helpful?