O'Reilly logo

Learning Angular for .NET Developers by Rajesh Gunasundaram

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Moving the Angular template to the ASP.NET MVC template

We have almost completed the application. However, we have only used Angular views as templates for the Angular components. We need to serve the template via ASP.NET MVC. This will enable us to add Razor codes, if necessary, as these views are powered by ASP.NET MVC. Follow the given steps to add Razor views and update the templateUrl in each Angular component:

  1. First, add three actions in HomeController, namely About, Contact, and Todo, as follows:
        public IActionResult   About()   
        {   
            return View();   
        }   
        public IActionResult   Contact()   
        {               return View();        }      
        public IActionResult   Todo()   
        {   
            return View();   
        }   
  1. Add three views, namely About, Contact, and Todo, under the Views -> Home folder, as shown: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required