I have an MCV controller method which can load a total of 3 separate views, two of which are error pages just containing some static html.
public ActionResult Index(string c)
{
try
{
var model = new HG.EnterpriseTools.Types.CodeContainer();
if (string.IsNullOrWhiteSpace(c))
return InvalidLink();
model = HG.EnterpriseTools.CareNotifyCodeManager.ValidateCode(c);
if (model.IsExpired)
{
return ExpiredLink();
}
if (!model.IsValid || model.PatientID == -1)
{
return InvalidLink();
}
else
{
return View();
}
}
catch (Exception ex)
{
Logger.Error("fooController Index :: Error ::" + ex.Message);
}
return InvalidLink();
}
I have an Index.cshtml which only contains <div ng-view></div>
and get's loaded in through the RenderBody()
like any standard MVC page. Once the Index page loads I want all other routing to be handled by Angular using ngRoute. Here is a small example of what my routeProvider configuration.
careNotify.config(function ($routeProvider) {
$routeProvider.when('/', {
controller: 'MainController',
templateUrl: 'Views/splash.html'
}).when('/login', {
controller: 'loginController',
templateUrl: 'Views/Account/login.html'
})
});
Yet when the index page loads and successfully attempts to load the default route as expected it fails with a 500 error. If instead I try to change the templateUrl
path to ../Views/splash.html
then I just get a 404. Any guidance? I'm still trying to wrap my head around mixing Angular and MVC with out needing to make a controller for each view and convert everything to .cshtml pages.