Skip to main content
main-content
Top

About this book

Combine the strengths of Angular, the leading framework for developing complex client-side applications, and ASP.NET Core MVC 3, the latest evolution of Microsoft’s framework for server-side applications. This new edition offers updated Angular, ASP.NET Core 3, Entity Framework Core 3 examples, an all-new chapter on interoperability with Blazor, and more!

Best-selling author Adam Freeman brings together these two key technologies and explains how to use ASP.NET Core MVC 3 to provide back-end services for Angular applications. This fast-paced and practical guide starts from the nuts and bolts and gives you the knowledge you need to combine Angular and ASP.NET Core MVC 3 in your projects.

Each topic is covered clearly and concisely and is packed with the essential details you need to learn to be truly effective.

What You Will Learn

Gain a solid understanding of how ASP.NET Core MVC 3 and Angular can work together Utilize both Visual Studio and Visual Studio Code to develop Angular/ASP.NET Core MVC projects Create ASP.NET Core RESTful web services to support Angular applications Expose data from Entity Framework Core to Angular applications Use ASP.NET Core Identity to provide security services to Angular applications Understand how Angular and Blazor applications can work together

Who This Book Is For

This book is for developers with knowledge of ASP.NET Core MVC who are introducing Angular into their projects.

Table of Contents

Chapter 1. Understanding Angular and ASP.NET Core MVC

Abstract
This book is about using Angular and ASP.NET Core MVC together to create rich applications. Individually, each of these frameworks is powerful and feature-rich, but using them together combines the dynamic flexibility of Angular with the solid infrastructure of ASP.NET Core MVC.
Adam Freeman

Chapter 2. Getting Ready

Abstract
In this chapter, I explain how to set up the tool packages required for Angular and ASP.NET Core MVC development. For quick reference, Table 2-1 lists the packages and explains their purpose. Follow the instructions for your preferred operating system to install the tools that are required for the rest of this book.
Adam Freeman

Chapter 3. Creating the Project

Abstract
In this chapter, I show you how to create a project that contains ASP.NET Core MVC and Angular applications, which means that both parts of the project can be developed using Visual Studio or Visual Studio Code. This project forms the foundation for the rest of this book, as I explain how to use Angular and ASP.NET Core MVC together to create a rich web application. Table 3-1 puts the combined project in context.
Adam Freeman

Chapter 4. Creating the Data Model

Abstract
In this chapter, I start adding functionality to the ASP.NET Core MVC and Angular parts of the project to create a data model. I’ll set up a SQL Server database to store the application data and define the model classes that Entity Framework Core will use to represent the data. On the Angular side, I’ll define the TypeScript classes that will represent the data and define a repository that will make the data available throughout the application. Table 4-1 puts creating the data model into context.
Adam Freeman

Chapter 5. Creating a Web Service

Abstract
In this chapter, I start the process of creating an HTTP web service that the Angular application can use to request data from ASP.NET Core MVC. This process is not as simple as it might be because of the way that different features interact, both in the MVC and Angular parts of the application, but the result is a solid foundation for accessing data that I build on in Chapter 6 to support a complete set of data operations.
Adam Freeman

Chapter 6. Completing the Web Service

Abstract
In Chapter 5, I created the web service and added support for handling HTTP GET requests. In this chapter, I complete the implementation by adding support for the POST, PUT, PATCH, and DELETE methods, which allows the client to create, update, and delete data.
Adam Freeman

Chapter 7. Structuring an Angular Application

Abstract
One of the biggest causes of confusion is the way that an Angular application is structured. The building blocks of an Angular application seem, at first glance, to be direct counterparts to those in an ASP.NET Core MVC application. But you will end up with a client-side application that doesn’t work or becomes impossible to modify if you treat the Angular building blocks in the same way as their ASP.NET counterparts.
Adam Freeman

Chapter 8. Creating the Store

Abstract
The publicly accessible part of the SportsStore application will allow customers to view the products that are on sale, add items to a cart, go through a checkout process, and provide ratings for the products they have purchased. All of these features are standard for most online stores, but as you might expect by now, there are some tricks and techniques required to get Angular and ASP.NET Core MVC to work together to create a good user experience. In this chapter, I create the structure of the Angular application’s store feature and start adding features. Table 8-1 puts the store features in context.
Adam Freeman

Chapter 9. Completing the Angular Store

Abstract
In this chapter, I complete the customer-facing features for the SportsStore application, allowing the user to add products to a shopping cart and checking out to place an order.
Adam Freeman

Chapter 10. Using Angular with Blazor

Abstract
In this chapter, I provide a brief introduction to Blazor and describe the different ways it can be used alongside Angular. As I explain, Angular remains a better choice for most projects, but if you have no choice but to use both, the techniques I describe in this chapter will be helpful. Bear in mind that combining two frameworks can be brittle and prone to problems, so keep things as simple as possible and always consider if you can consolidate everything into one framework.
Adam Freeman

Chapter 11. Creating Administration Features

Abstract
In this chapter, I build on the Angular and ASP.NET Core MVC features from earlier chapters to create the basic administration features required by the application. To keep the example application manageable, I don’t use all of the features that allowed me to demonstrate different aspects of Angular or ASP.NET Core MVC programming in earlier chapters, but I create enough new functionality to show that new additions can be assembled quickly and easily once the right foundation is in place. Table 11-1 puts this chapter in context.
Adam Freeman

Chapter 12. Securing the Application

Abstract
In this chapter, I finish the SportsStore application by setting up authentication and authorization so that administrative tasks, such as modifying or deleting data, can be done by approved users only. I explain how to restrict access to web services, how to use ASP.NET Core Identity to provide security services, and how to authenticate users using Angular. Table 12-1 puts application security in context.
Adam Freeman

Chapter 13. Preparing for Deployment

Abstract
There are lots of ways to deploy an ASP.NET Core MVC application, and I don’t get into the options in this book, but there are some changes that are required regardless of how the application is hosted.
Adam Freeman
Additional information