I am working on a MVC 5 project. When I use a html page at my views, it load that page but when I use .cshtml page it is not loading the view. The Blank page appears.
<
Adding a similar answer to Yasser's, but using ngRoute:
1) Instead of referencing your partial HTML, you need to reference a Controller/Action to your ASP.NET MVC app.
.when('/order', {
templateUrl: '/Order/Create',
controller: 'ngOrderController' // Angular Controller
})
2) Your ASP.NET MVC will return a .cshtml view:
public class OrderController : Controller
{
public ActionResult Create()
{
var model = new MyModel();
model.Test= "xyz";
return View("MyView", model);
}
}
3) Your MyView.cshtml will mix Razor and Angular. Attention: as its a partial for your Angular app, set the layout as null.
@model MyProject.MyModel
@{
Layout = null;
}
{{ Test }}
Model.Test