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
About the Author
About the Reviewers
Customer Feedback


Angular is the most popular JavaScript framework. Angular was completely rewritten with the benefits of ECMAScript 6 and supports object-oriented programming, static typing, generics, and lambdas by leveraging the power of TypeScript language.

This book will help you understand the benefits of using the Angular client-side MVC framework in .NET applications. You will learn how to use Angular with current technologies, such as MVC and the Web API. The book will show you how to develop single-page applications using Angular powered by the .NET framework. It also teaches you how to organize and maintain your code and how to integrate Angular into .NET applications. By the end of the book, you will feel comfortable adding either a little or a lot of Angular to your ASP.NET projects.

What this book covers

Chapter 1,Getting Started with Angular, introduces Angular and provides step-by-step instructions for building a Hello World app with Angular. It also explains the architecture of Angular.

Chapter 2, Angular Building Blocks Part 1, gives you a detailed walkthrough of the core building blocks of the Angular architecture, such as modules, components, decorators, metadata, templates, bindings, directives, and dependency injection.

Chapter 3, Angular Building Blocks Part 2, explains the functionalities of the remaining building blocks of the Angular architecture, such as forms, pipes, routers, services, and observables.

Chapter 4, Using TypeScript with Angular, discusses the fundamentals of TypeScript and the benefits of using TypeScript to write Angular applications.

Chapter 5, Creating an Angular Single-Page Application in Visual Studio, guides you through the process of creating an Angular single-page application using Visual Studio and using NPM and Gulp.

Chapter 6, Creating ASP.NET Core Web API Services for Angular, showcases RESTful web services and the ASP.NET Web API. Also, it takes you through the process of integrating the ASP.NET Web API with an Angular application.

Chapter 7, Creating an Application Using Angular, ASP.NET MVC, and Web API in Visual Studio, practically explains how to use ASP.NET MVC as a backbone of Angular application and how to combine the routings of Angular, ASP.NET MVC, and Web API.

Chapter 8, Testing Angular Applications, dives into the process of testing Angular components and services using the Jasmine framework.

Chapter 9, What's New in Angular and ASP.NET Core, outlines the new features of Angular. It also introduces ASP.NET Core and discusses cross-platform development with the .NET Execution Environment.

What you need for this book

The following software is required for this book:

  • Visual Studio 2017 or later
  • Visual Studio Code
  • Node.js 6.10.2 or later
  • Angular 4.0.0 or later
  • TypeScript 2.3.4 or later
  • Windows 10 or later

The following hardware is required for this book:

  • 1.6 GHz or faster processor
  • 1 GB of RAM (1.5 GB if running on a virtual machine)
  • 10 GB (NTFS) of available hard disk space
  • 5,400 RPM hard drive
  • DirectX 9-capable video card running at 1024 x 768 or higher display resolution

Who this book is for

This book is intended for everyone capable of developing ASP.NET Core 1.0 applications. Good working knowledge and experience of C# and the .NET framework are prerequisites for learning from this book.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "It uses HTTP under the hood and utilizes HTTP verbs, such as GET, POST, PUT, and DELETE, to control or access the resources."

A block of code is set as follows:

 public void ConfigureServices(IServiceCollection services) 

Any command-line input or output is written as follows:

npm run build:watch
karma start karma.conf.js

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "In Settings, we can also pick which configuration we will use and which of the DNX versions to use."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book--what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you. You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at We also have other code bundles from our rich catalog of books and videos available at Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books maybe a mistake in the text or the code we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.