I have an MVC.NET application with AngularJS. In my route provider, I use mvc controllers to return views as follows:
.when('/Units', {
templateUrl: 'Unit/Units'
})
.when('/UnitsDetail', {
templateUrl: 'Unit/UnitsDetail'
})
And my .NET UnitController has the following methods:
[Authorize]
public ActionResult Units()
{
return View();
}
[Authorize]
public ActionResult UnitsDetail()
{
ViewBag.reference = Guid.NewGuid().ToString().Substring(0, 6);
return View();
}
To represent UnitsDetail, I need a link that is created in the UnitsDetail () method.
The problem occurs when I switch from Units to UnitsDetail several times. The UnitsDetail () method is called for the first time, and thus a link is created, but if I go back to the units and earn UnitsDetail again, the method will not be called, and the link will be the same. I need to generate one link every time.
, JS AJAX Angular , , Angular UnitsDetail() , "#/UnitsDetail".
!