Book Image

Learning Angular for .NET Developers

By : Rajesh Gunasundaram
Book Image

Learning Angular for .NET Developers

By: Rajesh Gunasundaram

Overview of this book

Are you are looking for a better, more efficient, and more powerful way of building front-end web applications? Well, look no further, you have come to the right place! This book comprehensively integrates Angular version 4 into your tool belt, then runs you through all the new options you now have on hand for your web apps without bogging you down. The frameworks, tools, and libraries mentioned here will make your work productive and minimize the friction usually associated with building server-side web applications. Starting off with building blocks of Angular version 4, we gradually move into integrating TypeScript and ES6. You will get confident in building single page applications and using Angular for prototyping components. You will then move on to building web services and full-stack web application using ASP.NET WebAPI. Finally, you will learn the development process focused on rapid delivery and testability for all application layers.
Table of Contents (16 chapters)
Title Page
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Creating ASP.NET Web API services


Let's create or add ASP.NET Web API services to our My Todo application that we created in the last chapter. Our My Todo application was created using the Empty ASP.NET 5 template in Visual Studio 2015. When an empty project is created, it creates a lean web application. It does not include assemblies related to MVC or the Web API. So, we need to explicitly add the required assemblies or modules to implement the Web API in our application.

Adding and configuring an MVC service to the ASP.NET project

Since ASP.NET Core, the Web API, was merged with MVC, we need to add an MVC service to implement a Web API in our application:

  1. Install the NuGet package Microsoft.AspNetCore.MVC.
  2. Open the Startup.cs file from the root folder of the project in Visual Studio.
  3. Add the following statement under the ConfigureServices method to add the MVC service to our project
    public void   ConfigureServices(IServiceCollection   
    services)   
        {   
            services.AddMvc...