I am developing an application in Angular and ASP.NET MVC. I would like to keep some Angular partials and MVC partials in the same folder because they are logically related. For example:
- /MyApp/Widgets/Image-config.html
- /MyApp/Widgets/Image-designer.html
- /MyApp/Widgets/Image.cshtml
I was able to make the Widgets folder used as a shared partial folder by adding this to Global.asax:
ViewEngines.Engines.Add(new RazorViewEngine
{
PartialViewLocationFormats = new string[]
{
"~/Widgets/{0}.cshtml",
"~/Views/{1}/{0}.cshtml",
"~/Views/Shared/{0}.cshtml"
}
});
And copying the web.config from the default Views folder.
However, now I get a 404 when Angular goes to get the .html templates. Is there any way to configure the Widgets folder such that it can both serve up static files and be a location for my server-side partial views?