First of all, thanks for taking your time.
My problem is that I want to get a .cshtml (returned from MVC Controller) as template for my angular site.
At first I created a ASP.Net Core 2.1 Web Application Template: Angular. Second I added a Home Controller in the "Controller" Folder.
using Microsoft.AspNetCore.Mvc;
// For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace WebApplication4.Controllers
{
public class HomeController : Controller
{
// GET: /<controller>/
public IActionResult Index()
{
return View();
}
}
}
The next step was to create a folder named "Home" inside the "Pages" folder. Inside the Home folder I created a razor view called "index.cshtml" just filled with a
<h1>This is the Index View</h1>
Now I changed the templateUrl in app.component.ts to
templateUrl: '/home/index',
I saw all of that in a post from stackoverflow. I lost the link but here's the github the guy posted with it: https://github.com/ranjanmadhu/Angular2-101
Now I open my cmd, cd to the path of the project and try to build it via ng build.
Here comes the problem, it throws me this error:
ERROR in ./src/app/app.component.ts
Module not found: Error: Can't resolve './/home/index' in 'C:\Users\Myridor\AngularMvcTest\AngularMvcTest\ClientApp\src\app'
I hope someone can help me solve the problem.
Best regards, Nico aka. Myridor