I have a MVC project that I added Angular to. Ia m using ngRoute for the routing. Everything works fine except a few of the razor views. Specifically the views that require the id of the selected object to be passed on to the next view. So when I am managing users and click on edit or details I need that controller to return a simulated html href event. not sure if that is possible. Any suggestions on another way of doing this are welcome.
@Html.ActionLink("Edit", "Edit", new { id = item.Id })
Admin Controller
// GET: /Users/Edit/1
public async Task<ActionResult> Edit(string id)
{
if (id == null)
{
return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
}
var user = await UserManager.FindByIdAsync(id);
if (user == null)
{
return HttpNotFound();
}
var userRoles = await UserManager.GetRolesAsync(user.Id);
return View(new EditUserViewModel()
{
Id = user.Id,
UserName = user.UserName,
Email = user.Email,
CompanyName = user.CompanyName,
Name = user.Name,
RolesList = RoleManager.Roles.ToList().Select(x => new SelectListItem()
{
Selected = userRoles.Contains(x.Name),
Text = x.Name,
Value = x.Name
})
});
}
I need to somehow route this through angular such as the User create page
<a href="#!/usersAdminCreate"><span class="nav-label">Add User</span></a>