Easy To Learn .NET 6.0 And Angular - Getting Started Angular Template

Good day all this time I have planned to publish .NET 6.0 and Angular series of articles. In this series, I have planned to publish articles like

  • Easy to learn .NET 6.0 and Angular - Getting Started Angular Template – Part 1
  • Easy to learn .NET 6.0 and Angular - Getting Started Angular Standalone Template – Part 2
  • Easy to learn .NET 6.0 and Angular - Getting Started Admin LTE Design – Part 3
  • Easy to learn .NET 6.0 and Angular - Getting Started Multi Language – Part 4
  • Easy to learn .NET 6.0 and Angular - Getting Started Publish to IIS – Part 5
  • Easy to learn .NET 6.0 and Angular - Getting Started WEB API – Part 6
  • Easy to learn .NET 6.0 and Angular - Getting Started WEB API CRUD SQL SERVER – Part 7


In this article, we will see in detail how to get started with the .NET 6.0 and Angular using the Angular Template which is available in Visual Studio 2022.

.NET 6.0 has more improvement on the performance which includes on major advantage as it has intelligent code editing and also it is called the fastest full stack web framework. The .NET 6.0 also provides better performance in the File Stream.

When you create a new Angular Template project using Visual Studio 2022 you can notice as the Asp.NET Core 6.0 and Angular 13 version has been used as both .NET6.0 and Angular 13 is new versions and surely it will be quite interesting and fun to learn and work with new things.


  • Visual Studio 2022
  • Node.js – If you don’t have Node.js install Node.js (Download link).

Visual Studio 2022

If you have not yet installed Visual Studio 2022 then you can download the Visual studio 2022 from this link and install it on your computer.

Download and install the Visual Studio 2022.

Note: The Community version is free for all and you can download the community version as if you don’t have the Installation Key, if you have the Installation key or have the MSDN subscription then you can download the Professional or Enterprise version.

As a Microsoft MVP I have the MSDN subscription and I have installed the Professional version.

Create ASP.NET Core with Angular Template

After installing all the prerequisites listed above and click Start >> Programs >> Visual Studio 2022 >> Visual Studio 2022 on your desktop. Click New >> Project.

Easy to learn .NET 6.0 and Angular

Search for Angular Template and Select ASP.NET Core with Angular and click Next.

Easy to learn .NET 6.0 and Angular

Enter your project name and click Next.

Easy to learn .NET 6.0 and Angular

Now we can see as the Framework is .NET 6.0(Long term support). Click on the Create button.

Easy to learn .NET 6.0 and Angular

When we create the project, we can see the Solution structure like below.

Here we can see few interesting and new files has been added and we can also see as here in Visual Studio there is no Startup.cs file which was the main class for the Asp.NET Core projects in 2019 versions.

Visual Studio 2019 with Startup.cs

If you had worked with the ASP.NET MVC and ASP.NET Core you might be aware about the Startup.cs class. As this class is very main class for all the .NET and .NET Core applications. This Startup.cs class contains configure and configureService methods.

As this class is used to register all our services which our application is needed in ConfigureService and the configure methods used as the middleware pipeline for controlling the application.

Easy to learn .NET 6.0 and Angular

Visual Studio 2022 does not need the Startup.cs

When we create ASP.NET Core 6.0 and Angular Application the Startup.cs class file will be missing. Yes, now all the Configure and ConfigureService related services will be added to the Program.cs file.

For example, if we need to add the connection string and need to add the DBContext means then we can add it to the Program.cs file with builder.Service.AddDbContext() . To add all the services we can use the builder object as we can see for adding the DBContext service we use the builder.Service.AddDbContext().

Easy to learn .NET 6.0 and Angular

We can see that as there is no main method, class and using headers in the program.cs file, don’t panic, yes now in the .NET 6.0 the codes are made simpler and the intelligent code supports seem to be more advanced and now it’s easier and reduces the time on working our codes and projects.

Top-Level statements

This is called as the Top-Level statements as the main method is not needed from the C# 9. The main aim of the Top-Level statement is to reduce the code and improve the performance, The main method and the class will be created by the compiler as we no need to write separate code for it.

New Angular Files Part


This JavaScript file set up the HTTPS for the application which is targeted to use the ASP.NET Core HTTPS certificates.

Easy to learn .NET 6.0 and Angular


This JavaScript file is used to add our HTTPs ports, WEB API URL as target and in the context, we will be adding all our controller and methods to get access in the angular application.

Easy to learn .NET 6.0 and Angular

Build and Run the Application

When we run the application, we can see by default the home. Counter and Fetch data components has been added to menu and we can navigate to each menu and see the component results.

Easy to learn .NET 6.0 and Angular

Current Month Item Wise Sales Details Making

Now let’s make a simple WEB API controller to get the Item Sales details.

Creating Model Class

For this first we need to add the class file to create our Model Class. Right click the project and click > Add > New Item. Select Class and name it as ItemDetails.cs and click add.

In the class add property variables like below code.

public class ItemDetails {
    public String ItemCode {
    public int SaleCount {

Creating API Controller Class

Right click Controllers folder and click > Add > Controller. Select API > Select API Controller – Empty and click Add

Easy to learn .NET 6.0 and Angular

Give the empty API Controller name as ItemDetailsController.cs and click Add.

In the controller we add Get Method which will create random 10 item code along with random Sale count value range from 20 to 100.

public class ItemDetailsController: ControllerBase {
    private readonly ILogger < ItemDetailsController > _logger;
    public ItemDetailsController(ILogger < ItemDetailsController > logger) {
            _logger = logger;
        [HttpGet(Name = "GetItemDetails")]
    public IEnumerable < ItemDetails > Get() {
        var rng = new Random();
        int ivale = 0;
        return Enumerable.Range(1, 10).Select(index => new ItemDetails {
            ItemCode = "ITM_" + rng.Next(1, 100),
                SaleCount = rng.Next(20, 100),

This is first article in this series, later when we use the SQL Server for CRUD then we can see more in detail as to how actually the real world examples work.

Angular Part

Here I use the default home Angular components to update for showing the Item details with sale count.

home Component

In the home component I have updated the code by adding the HTTPClient import part also Inject import part.

Then I create the interface with ItemDetails as same we created in Model class.

In the Constructor method using the http.get method we get the API JSON results and bind it to the itemsdetails to display the results in the HTML page.

import { Component, Inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
  selector: 'app-home',
  templateUrl: './home.component.html',

export class HomeComponent {
  public itemsdetails: ItemDetails[] = [];
  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
    http.get<ItemDetails[]>(baseUrl + 'ItemDetails').subscribe(result => {
      this.itemsdetails = result;
    }, error => console.error(error));
interface ItemDetails {
  itemCode: string;
  saleCount: number;


In the HTML add the below code to display the results of ItemCode and salescount from API.

<h1>Current Month Item wise Sales Details</h1>
<table class='table table-striped' aria-labelledby="tableLabel" *ngIf="itemsdetails">
      <th>Item Code</th>
      <th>Sales Count</th>
    <tr *ngFor="let itemdetail of itemsdetails">
      <td>{{ itemdetail.itemCode }}</td>
      <td>{{ itemdetail.saleCount }}</td>

Build and Run

Build and run the application. In the Home page we can see the result like below and you can notice as we are not able to see the Item Details and sale count values. This is because we didn’t add yet the controller class and method in the proxy.config.js file. In order to use the WEB API in Angular App we need to add the WEB API Controller and methods in Proxy.config.js context array.

Easy to learn .NET 6.0 and Angular

You can see from the below image now we have added our controller named as ItemDetails in the proxy.config.js file context array.

Easy to learn .NET 6.0 and Angular

Run the application to see the result. Now we can see as our WEB API results has been binded in our home page with Item Code and Sales Count.

Easy to learn .NET 6.0 and Angular


Hope this article helps to understand on getting started with ASP.NET Core and Angular using Visual Studio 2022. In the next part, we will see more in detail on how to using the ASP.NET Core for creating the Standalone Angular application.