Best way to get data from MVC layer into the Angular layer. #734

Closed
opened 2025-08-09 17:17:28 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @jrmcdona on 5/20/2017

I am using AAD and trying to go get values from HttpContext.

Right now I am returning it to _Layout.cshtml and grabbing it from the DOM in Angular.

But this cannot be the right way!

For example:
public IActionResult Index()
{
var viewModel = new AppViewModel()
{
IsAuthenticated = HttpContext.User.Identity.IsAuthenticated
};
return View(viewModel);
}

Thanks

*Originally created by @jrmcdona on 5/20/2017* I am using AAD and trying to go get values from HttpContext. Right now I am returning it to _Layout.cshtml and grabbing it from the DOM in Angular. But this cannot be the right way! For example: public IActionResult Index() { var viewModel = new AppViewModel() { IsAuthenticated = HttpContext.User.Identity.IsAuthenticated }; return View(viewModel); } Thanks
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#734
No description provided.