Introduction
In this step by step tutorial, I'm going to perform CRUD operations in an Angular 7 Web application. The backend is a SQL Server database. A Web API is used to provide data connectivity between the database and the front end application. On the UI side, I will use the Angular Material theme to create a rich, interactive, and device-independent user experience.
I'm using Visual Studio Code as a tool to build my application. If you don't have Visual studio code in your system then first you have to download and install. Here is Visual Studio Code download link: Download Visual Studio Code Editor
Step 1. Create a database table
Create a database. Open SQL Server and create a new database table. As you can see from the following image, I create a database table called EmployeeDetails with 7 columns.
Note: If you already have an existing database and table, you can skip this step.
Step 2. Create a Web API Project
Now, we will create a Web API with the functionality of Create, Replace, Update, and Delete (CRUD) operations.
Open Visual Studio >> File >> New >> Project >> Select Web Application. After that click OK and you will see the templates. Select the Web API template.
Click OK.
Step 3. Add ADO.NET Entity Data Model
Now, Select Models folder >> Right click >>Add >> New Item >> select Data in left panel >>ADO.NET Entity Data Model,
Now click Add button then select EF Designer from database >> Next >> After that give your SQL credential and select the database where your database table and data are.
Click the Add button and select your table and click on the Finish button.
Step 4. CRUD Operations
Now, we will write code to perform CRUD operation.
Go to the Controller folder in our API Application and right click >> Add >> Controller >> Select Web API 2 Controller-Empty
Now, we will go to the controller class and set the routing to make it more user friendly by writing the below code.
- using System;
- using System.Linq;
- using System.Web.Http;
- using CRUDAPI.Models;
- namespace CRUDAPI.Controllers
- {
- [RoutePrefix("Api/Employee")]
- public class EmployeeAPIController : ApiController
- {
- WebApiDbEntities objEntity = new WebApiDbEntities();
- [HttpGet]
- [Route("AllEmployeeDetails")]
- public IQueryable<EmployeeDetail> GetEmaployee()
- {
- try
- {
- return objEntity.EmployeeDetails;
- }
- catch(Exception)
- {
- throw;
- }
- }
- [HttpGet]
- [Route("GetEmployeeDetailsById/{employeeId}")]
- public IHttpActionResult GetEmaployeeById(string employeeId)
- {
- EmployeeDetail objEmp = new EmployeeDetail();
- int ID = Convert.ToInt32(employeeId);
- try
- {
- objEmp = objEntity.EmployeeDetails.Find(ID);
- if (objEmp == null)
- {
- return NotFound();
- }
- }
- catch (Exception)
- {
- throw;
- }
- return Ok(objEmp);
- }
- [HttpPost]
- [Route("InsertEmployeeDetails")]
- public IHttpActionResult PostEmaployee(EmployeeDetail data)
- {
- if (!ModelState.IsValid)
- {
- return BadRequest(ModelState);
- }
- try
- {
- objEntity.EmployeeDetails.Add(data);
- objEntity.SaveChanges();
- }
- catch(Exception)
- {
- throw;
- }
- return Ok(data);
- }
- [HttpPut]
- [Route("UpdateEmployeeDetails")]
- public IHttpActionResult PutEmaployeeMaster(EmployeeDetail employee)
- {
- if (!ModelState.IsValid)
- {
- return BadRequest(ModelState);
- }
- try
- {
- EmployeeDetail objEmp = new EmployeeDetail();
- objEmp = objEntity.EmployeeDetails.Find(employee.EmpId);
- if (objEmp != null)
- {
- objEmp.EmpName = employee.EmpName;
- objEmp.Address = employee.Address;
- objEmp.EmailId = employee.EmailId;
- objEmp.DateOfBirth = employee.DateOfBirth;
- objEmp.Gender = employee.Gender;
- objEmp.PinCode = employee.PinCode;
- }
- int i = this.objEntity.SaveChanges();
- }
- catch(Exception)
- {
- throw;
- }
- return Ok(employee);
- }
- [HttpDelete]
- [Route("DeleteEmployeeDetails")]
- public IHttpActionResult DeleteEmaployeeDelete(int id)
- {
- //int empId = Convert.ToInt32(id);
- EmployeeDetail emaployee = objEntity.EmployeeDetails.Find(id);
- if (emaployee == null)
- {
- return NotFound();
- }
- objEntity.EmployeeDetails.Remove(emaployee);
- objEntity.SaveChanges();
- return Ok(emaployee);
- }
- }
- }
As you may see from the above code, it has functionality to add, replace, update, and delete records to the table.
Step 5. Build UI Application
Now, we create the Web application in Angular 7 that will consume Web API.
First we have to make sure that we have Angular CLI installed.
Open command prompt and type below code and press ENTER:
npm install -g @angular/cli
Now, open Visual Studio Code and create a project.
Open TERMINAL in Visual Studio Code and type the following syntax to create a new project. We name it Angularcrud.
Once created, the project should look like this.
Now, we can create some components to provide the UI.
I'm going to create a new component, Employee.
Go to the TERMINAL and go our angular project location using the following command:
cd projectName

Now, write the following command that will create a component.
ng g c employee
Press ENTER.
Note: you can use see the component is created.
Step 6. Create a Service
Now, we will create a service.
Open the TERMINAL and write the below command:
ng g s employee
Press ENTER and you will see two service files.
Now, we create a class like model class.
Open TERMINAL and write the below command:
ng g class employee
Now, write all properties of the Employee class related to an employee that matches with the database.
- export class Employee {
- EmpId: string;
- EmpName: string;
- DateOfBirth: Date;
- EmailId: string;
- Gender: string;
- Address: string;
- PinCode: string;
- }
Now, open employee.service.ts and first import necessary class and libraries and then make calls to the WebAPI methods.
- import { Injectable } from '@angular/core';
- import { HttpClient } from '@angular/common/http';
- import { HttpHeaders } from '@angular/common/http';
- import { Observable } from 'rxjs';
- import { Employee } from './employee';
- After that we write all methods related to consume web in employee.service.ts
- @Injectable({
- providedIn: 'root'
- })
- export class EmployeeService {
- url = 'http://localhost:65389/Api/Employee';
- constructor(private http: HttpClient) { }
- getAllEmployee(): Observable<Employee[]> {
- return this.http.get<Employee[]>(this.url + '/AllEmployeeDetails');
- }
- getEmployeeById(employeeId: string): Observable<Employee> {
- return this.http.get<Employee>(this.url + '/GetEmployeeDetailsById/' + employeeId);
- }
- createEmployee(employee: Employee): Observable<Employee> {
- const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json'}) };
- return this.http.post<Employee>(this.url + '/InsertEmployeeDetails/',
- employee, httpOptions);
- }
- updateEmployee(employee: Employee): Observable<Employee> {
- const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json'}) };
- return this.http.put<Employee>(this.url + '/UpdateEmployeeDetails/',
- employee, httpOptions);
- }
- deleteEmployeeById(employeeid: string): Observable<number> {
- const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json'}) };
- return this.http.delete<number>(this.url + '/DeleteEmployeeDetails?id=' +employeeid,
- httpOptions);
- }
- }
Our service is completed now.
If you consume the Web API, Angular blocks the URL and we called this issue CORS(Cross OriginResource Sharing).
First, let's resolve this problem.
Go to the Web API project.
Download a Nuget package for CORS. Go to NuGet Package Manager and download the following file.
After that, go to App_Start folder in Web API project and open WebApiConfig.cs class. Here, modify the Register method with the below code.
- Add namespace
- using System.Web.Http.Cors;
- var cors = new EnableCorsAttribute("*","*","*");//origins,headers,methods
- config.EnableCors(cors);
Step 7. Install and Configure Angular Material Theme
As I said earlier, we will use the Angular Material theme to create a rich, interactive, and device-oriented UI for our Web app.
Let's install Install Angular Material theme.
Open TERMINAL again and write the below command:
npm install --save @angular/material @angular/cdk @angular/animations
If you want to learn more about Angular Material, visit here: link.
After installed successfully, we can check in package.json file.
Now, let's all required libraries in app.module.ts. We also import a date picker because we'll use the date picker for date of birth field.
Now, open app.module.ts class and write the below code.
- import { BrowserModule } from '@angular/platform-browser';
- import { NgModule } from '@angular/core';
- import { EmployeeService } from './employee.service';
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
- import { HttpClientModule, HttpClient } from '@angular/common/http';
- import {
- MatButtonModule, MatMenuModule, MatDatepickerModule,MatNativeDateModule , MatIconModule, MatCardModule, MatSidenavModule,MatFormFieldModule,
- MatInputModule, MatTooltipModule, MatToolbarModule
- } from '@angular/material';
- import { MatRadioModule } from '@angular/material/radio';
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
- import { AppRoutingModule } from './app-routing.module';
- import { AppComponent } from './app.component';
- import { EmployeeComponent } from './employee/employee.component';
- @NgModule({
- declarations: [
- AppComponent,
- EmployeeComponent
- ],
- imports: [
- BrowserModule,
- FormsModule,
- ReactiveFormsModule,
- HttpClientModule,
- BrowserAnimationsModule,
- MatButtonModule,
- MatMenuModule,
- MatDatepickerModule,
- MatNativeDateModule,
- MatIconModule,
- MatRadioModule,
- MatCardModule,
- MatSidenavModule,
- MatFormFieldModule,
- MatInputModule,
- MatTooltipModule,
- MatToolbarModule,
- AppRoutingModule
- ],
- providers: [HttpClientModule, EmployeeService,MatDatepickerModule],
- bootstrap: [AppComponent]
- })
- export class AppModule { }
Now, we have to import library in styles.css file.
- @import '@angular/material/prebuilt-themes/indigo-pink.css';
Step 8. Design HTML
Let's design our HTML page now.
Open employee.component.html and write the below code.
- <div class="container">
- <mat-card>
- <mat-toolbar color="accent">
- <div align="center" style="color:white;text-align: right;">
- CRUD operation in Angular 7 using Web api and Sql Database
- </div>
- </mat-toolbar>
- <br><br>
- <mat-card-content>
- <form [formGroup]="employeeForm"(ngSubmit)="onFormSubmit(employeeForm.value)">
- <table>
- <tr>
- <td class="tbl1">
- <mat-form-field class="demo-full-width">
- <input formControlName="EmpName" matTooltip="Enter Employee Name" matInput placeholder="Employee Name">
- </mat-form-field>
- <mat-error>
- <span *ngIf="!employeeForm.get('EmpName').value && employeeForm.get('EmpName').touched"></span>
- </mat-error>
- </td>
- <td class="tbl1">
- <mat-form-field class="demo-full-width">
- <input matInput [matDatepicker]="picker"matTooltip="Enter Date Of Birth" formControlName="DateOfBirth"placeholder="Choose Date Of Birth">
- <mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
- <mat-datepicker #picker></mat-datepicker>
- </mat-form-field>
- <mat-error>
- <span *ngIf="!employeeForm.get('DateOfBirth').value && employeeForm.get('DateOfBirth').touched"></span>
- </mat-error>
- </td>
- <td class="tbl1">
- <mat-form-field class="demo-full-width">
- <input formControlName="EmailId" matTooltip="Enter EmailId" matInput placeholder="EmailId">
- </mat-form-field>
- <mat-error>
- <span *ngIf="!employeeForm.get('EmailId').value && employeeForm.get('EmailId').touched"></span>
- </mat-error>
- </td>
- </tr>
- <tr>
- <td class="tbl1">
- <span>Gender</span>
- <br><br>
- <mat-radio-group matTooltip="Enter Gender"formControlName="Gender">
- <mat-radio-button value="0">Male</mat-radio-button>
- <mat-radio-button value="1">Female</mat-radio-button>
- </mat-radio-group>
- <mat-error>
- <span *ngIf="!employeeForm.get('Gender').value && employeeForm.get('Gender').touched"></span>
- </mat-error>
- </td>
- <td class="tbl1">
- <mat-form-field class="demo-full-width">
- <input matTooltip="Enter Address"formControlName="Address" matInput placeholder="Address">
- </mat-form-field>
- <mat-error>
- <span *ngIf="!employeeForm.get('Address').value && employeeForm.get('Address').touched"></span>
- </mat-error>
- </td>
- <td class="tbl1">
- <mat-form-field class="demo-full-width">
- <input formControlName="PinCode" matTooltip="Enter Pine Code" matInput placeholder="PinCode">
- </mat-form-field>
- <mat-error>
- <span *ngIf="!employeeForm.get('PinCode').value && employeeForm.get('PinCode').touched"></span>
- </mat-error>
- </td>
- </tr>
- <tr>
- <td></td>
- <td class="content-center">
- <button type="submit" mat-raised-button color="accent"matTooltip="Click Submit Button"[disabled]="!employeeForm.valid">Submit</button>
- <button type="reset" mat-raised-button color="accent"matTooltip="Click Reset Button" (click)="resetForm()">Reset</button>
- </td>
- <td>
- <p *ngIf="dataSaved" style="color:rgb(0, 128, 0);font-size:20px;font-weight:bold" Class="success" align="left">
- {{massage}}
- </p>
- </td>
- </tr>
- </table>
- <br><br>
- <table class="table" >
- <tr ngclass="btn-primary">
- <th class="tbl2">Employee Name</th>
- <th class="tbl2">Date Of Birth</th>
- <th class="tbl2">Email Id</th>
- <th class="tbl2">Gender</th>
- <th class="tbl2">Address</th>
- <th class="tbl2">Pine Code</th>
- <th class="tbl2">Edit</th>
- <th class="tbl2">Delete</th>
- </tr>
- <tr *ngFor="let employee of allEmployees | async">
- <td class="tbl2">{{employee.EmpName}}</td>
- <td class="tbl2">{{employee.DateOfBirth | date }}</td>
- <td class="tbl2">{{employee.EmailId}}</td>
- <td class="tbl2">{{employee.Gender ==0? 'Male' : 'Female'}}</td>
- <td class="tbl2">{{employee.Address}}</td>
- <td class="tbl2">{{employee.PinCode}}</td>
- <td class="tbl2">
- <button type="button" class="btn btn-info"matTooltip="Click Edit Button"(click)="loadEmployeeToEdit(employee.EmpId)">Edit</button>
- </td>
- <td class="tbl2">
- <button type="button" class="btn btn-danger"matTooltip="Click Delete Button"(click)="deleteEmployee(employee.EmpId)">Delete</button>
- </td>
- </tr>
- </table>
- </form>
- </mat-card-content>
- </mat-card>
- </div>
Step 9
Open app.component.html and write the below code.
- <p>
- <app-employee></app-employee>
- </p>
Step 10
Open employee.component.ts file and write the below code.
- import { Component, OnInit } from '@angular/core';
- import { FormBuilder, Validators } from '@angular/forms';
- import { Observable } from 'rxjs';
- import { EmployeeService } from '../employee.service';
- import { Employee } from '../employee';
- @Component({
- selector: 'app-employee',
- templateUrl: './employee.component.html',
- styleUrls: ['./employee.component.css']
- })
- export class EmployeeComponent implements OnInit {
- dataSaved = false;
- employeeForm: any;
- allEmployees: Observable<Employee[]>;
- employeeIdUpdate = null;
- massage = null;
- constructor(private formbulider: FormBuilder, private employeeService:EmployeeService) { }
- ngOnInit() {
- this.employeeForm = this.formbulider.group({
- EmpName: ['', [Validators.required]],
- DateOfBirth: ['', [Validators.required]],
- EmailId: ['', [Validators.required]],
- Gender: ['', [Validators.required]],
- Address: ['', [Validators.required]],
- PinCode: ['', [Validators.required]],
- });
- this.loadAllEmployees();
- }
- loadAllEmployees() {
- this.allEmployees = this.employeeService.getAllEmployee();
- }
- onFormSubmit() {
- this.dataSaved = false;
- const employee = this.employeeForm.value;
- this.CreateEmployee(employee);
- this.employeeForm.reset();
- }
- loadEmployeeToEdit(employeeId: string) {
- this.employeeService.getEmployeeById(employeeId).subscribe(employee=> {
- this.massage = null;
- this.dataSaved = false;
- this.employeeIdUpdate = employee.EmpId;
- this.employeeForm.controls['EmpName'].setValue(employee.EmpName);
- this.employeeForm.controls['DateOfBirth'].setValue(employee.DateOfBirth);
- this.employeeForm.controls['EmailId'].setValue(employee.EmailId);
- this.employeeForm.controls['Gender'].setValue(employee.Gender);
- this.employeeForm.controls['Address'].setValue(employee.Address);
- this.employeeForm.controls['PinCode'].setValue(employee.PinCode);
- });
- }
- CreateEmployee(employee: Employee) {
- if (this.employeeIdUpdate == null) {
- this.employeeService.createEmployee(employee).subscribe(
- () => {
- this.dataSaved = true;
- this.massage = 'Record saved Successfully';
- this.loadAllEmployees();
- this.employeeIdUpdate = null;
- this.employeeForm.reset();
- }
- );
- } else {
- employee.EmpId = this.employeeIdUpdate;
- this.employeeService.updateEmployee(employee).subscribe(() => {
- this.dataSaved = true;
- this.massage = 'Record Updated Successfully';
- this.loadAllEmployees();
- this.employeeIdUpdate = null;
- this.employeeForm.reset();
- });
- }
- }
- deleteEmployee(employeeId: string) {
- if (confirm("Are you sure you want to delete this ?")) {
- this.employeeService.deleteEmployeeById(employeeId).subscribe(() => {
- this.dataSaved = true;
- this.massage = 'Record Deleted Succefully';
- this.loadAllEmployees();
- this.employeeIdUpdate = null;
- this.employeeForm.reset();
- });
- }
- }
- resetForm() {
- this.employeeForm.reset();
- this.massage = null;
- this.dataSaved = false;
- }
- }
Step 11. Run
We have completed all needed code functionality for our CRUD operations. Before running the application, first, make sure to save your work.
Now, let's run the app and see how it works.
Open TERMINAL and write the following command to run the program.
ng serve -o
The output looks like the following image. It's a stunning UI created with CRUD operations.

Congratulations!
You've finished a completed Web app with CRUD functionality. The App uses a Web API to provide data access from a SQL Server.
Now, start playing with the app by adding, updating, and deleting data.
Thank you for reading my article.

Srikanth YelluPosted Sep 1, 2021, 1:28 AM
In html u passed a argument inside onFormSubmit(*****) where as in methods of .ts file u didn't i am getting that error
Andre WillyPosted Jun 23, 2021, 2:54 PM
Hi, I'm Andre. I just learn about angular but 11 version. Is there any big difference with angular 7 that you use? Thanks
Rahul MauryaPosted May 24, 2021, 11:36 AM
Ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
JosephsPosted May 16, 2021, 1:06 PM
His XML file does not appear to have any style information associated with it. The document tree is shown below.
JosephsPosted May 16, 2021, 12:25 PM
How to run EmployeeAPIController ?
JosephsPosted May 13, 2021, 7:51 AM
When i run this always going DefaultAPI, I am setting routeconfig also it is not working
Shihadop ShihadPosted Apr 25, 2021, 4:56 AM
plz explain this code. it will help me a lot "WebApiDbEntities objEntity = new WebApiDbEntities();"
pranali pashtePosted Mar 19, 2021, 10:08 AM
Cannot retrieve the values
Abhishek TyagiPosted Feb 23, 2021, 10:55 AM
Hi Mithilesh, I am getting this error : Can't bind to 'formGroup' since it isn't a known property of 'form'.
Jacques VisagiePosted Feb 2, 2021, 5:35 AM
To Whomever my stumble upon this article - keep in mind that if you are to retrieve data from a web api, that the API changes the case of the property names, so if you have a table with a column name "MyStringColumn" or some such name, that it will be returned by the web API as "myStringColum" in the JSON ,which does not directly get translated by the angular service making the call to retrieve the data. I am sorry for possibly not using the correct technical jargon & correct terminology, but I am glad to have finally figured out why my data would not display. I hope no one has to struggle like I did. This was done in a later version of Angular & the web API was created with .Net core 3.1 for clarity's sake.
Riddhi ValechaPosted Jan 29, 2021, 8:54 AM
Hello Sir, I am not able to download the ZIP File.
Ajay DhangarPosted Jan 21, 2021, 7:08 AM
Record save by insert method but unable to run get method. error like The requested resource does not support http method 'GET'.
Pranav BajpaiPosted Jan 14, 2021, 5:55 PM
What do I have to do to view a file after uploading it?
saba afnanPosted Jan 8, 2021, 11:46 AM
I am getting error on ngsubmit although reactivemodules is imported
saba afnanPosted Jan 6, 2021, 10:53 AM
Hi i am getting http failure error
ravi kumarPosted Oct 27, 2020, 12:34 AM
Hi im getting some errors like ... "index.d.ts' is not a module". and "Cannot find module './app-routing.module' or its corresponding type declarations.ts(2307)" in VS Code Editor can you help me
Eduardo David Ruiz PinchePosted Oct 23, 2020, 12:19 PM
How would I record the data from two tables and show you in another form only some of the columns of the two tables.Let's say customers (customer_id, customer_name, age, country) sales (id_ven, series, number, id_cli, total sale) summary ven_id, series, number, customer_name, total sale), this in a grid
Hello WorldPosted Sep 29, 2020, 5:17 AM
I asked a stupid question here, as I started with a .Net Core project, and it seems to be a bad idea with this solution.
Saravanakumar TPosted Sep 21, 2020, 2:43 AM
I faced error in the post method with Empid column when creating new entries, 0 was passed for all the new records which resulted in duplicate record error....I resolved it by adding Identity(1,1) for Empid column, now it is working fine.
sreenivasa kPosted Aug 19, 2020, 1:05 PM
Really good .thank for providing
VINOTHKUMAR RPosted Jul 29, 2020, 9:54 AM
Src/app/employee/employee.component.ts:9:16 9 templateUrl: './employee.component.html', ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error occurs in the template of component EmployeeComponent.
VINOTHKUMAR RPosted Jul 29, 2020, 9:50 AM
I get following error : ERROR in src/app/employee/employee.component.html:11:67 - error TS2554: Expected 0 arguments, but got 1. 11 <form [formGroup]="employeeForm" (ngSubmit)="onFormSubmit(employeeForm.value)">
Shivam MittalPosted Jul 18, 2020, 7:30 AM
I have faced the same problem ie coming white blank screen. Even API and Web are working with no error. I am using VS2017.
Rahul KumarPosted Jul 11, 2020, 2:36 AM
<Error><Message>No HTTP resource was found that matches the request URI 'http://localhost:57514/Api/Employee'.</Message><MessageDetail>No type was found that matches the controller named 'Employee'.</MessageDetail> </Error> My controller name is EmployeeAPIController.cs
Rahul KumarPosted Jul 11, 2020, 2:28 AM
Im getting blank white screen after do all thing as you show in above code.So Please help me sir
Roger DelislePosted Jul 8, 2020, 8:17 PM
My url = http://localhost:65389/Api/Employee. Like I said, it works fine only when VS2019 is open and F5 was use at least once on the project. Any other suggestion? Thank you.
Roger DelislePosted Jul 6, 2020, 7:23 PM
I've done this tutorial and it works fine when using "ng serve -o" and when published in IIS manager, But only if my VS2019 is open. If closed it doesn't pull any data from the SQL server, but display the page properly.
गौरव पवारPosted Jun 29, 2020, 6:15 AM
Getting below result when trying to show all records i.e. loadAllEmployees(). { "closed": true, "_parentOrParents": null, "_subscriptions": null, "syncErrorValue": null, "syncErrorThrown": false, "syncErrorThrowable": true, "isStopped": true, "destination": { "closed": true, "_parentOrParents": null, "_subscriptions": null, "syncErrorValue": null, "syncErrorThrown": false, "syncErrorThrowable": false, "isStopped": true, "destination": { "closed": true }, "_parentSubscriber": null, "_context": null } }
Umesh MandalPosted Jun 25, 2020, 3:59 AM
Hello Senior I have got your code and everything is fine but i got one simple problem can you please help me ! problem is : Class constructor Platform cannot be invoked without 'new'
arun ksPosted May 10, 2020, 3:35 PM
Am getting error in app.module.ts @angular/material is not a module.
Anil NaniPosted Apr 29, 2020, 11:22 AM
Am getting error when running webapi code i.e., The program '[12212] iisexpress.exe' has exited with code 0 (0x0).my internet is fine. but Not debugging Program please help on this isue
Anil NaniPosted Apr 29, 2020, 11:19 AM
Am getting error when running webapi code i.e., The program '[12212] iisexpress.exe' has exited with code 0 (0x0).
Ms PishbinPosted Apr 22, 2020, 1:14 PM
Thank you very much
Khushboo RahmanPosted Apr 22, 2020, 12:29 AM
This is not run properly there is error in employee.component.ts The error is property name does not exist on type Employee[]....pls give me solution
Victor MaziluPosted Apr 14, 2020, 12:35 AM
My application does not have WebApiDbEntities . What should I use ?
Mauricio _Posted Mar 4, 2020, 4:45 PM
Thank you very much for your tutorial. That's nice. Just a question, what is the name from your visual studio code theme?
Vikramraj PatilPosted Feb 6, 2020, 12:56 AM
Its easy step by steps article for beginners
Agilan VPosted Dec 24, 2019, 9:09 AM
Thanks You!!!!!!!!!!!!!!!!!!!Best code for amateur full stack developers....Keep posting more code...!
annu vermaPosted Nov 19, 2019, 2:31 AM
M facing this error Access to XMLHttpRequest at 'http://localhost:53113/api/Customer/AddEnquiry/' from origin 'http://localhost:4200' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values '*, http://localhost:4200', but only one is allowed.
Az IzPosted Oct 25, 2019, 3:41 AM
Bro do u have angular authentication with api from asp.net?
Az IzPosted Oct 22, 2019, 7:55 PM
Hey bro when i run the app i have white screen
Abhishek sharmaPosted Oct 22, 2019, 7:54 AM
GET request is working as I am able to see records from database but POST and PUT requests (Add/Update new employees) are not working....any idea about this?
Abhishek sharmaPosted Oct 22, 2019, 5:43 AM
Hi, I think my angular project is not connected with the API project....how to check that?
Thuvarahan sritharanPosted Sep 15, 2019, 4:51 AM
Thanks, MithileshKumar. This is really great article for beginners to learn Angular Js 7 or an upper version with Web API C# Project.
Jignesh PatelPosted Sep 11, 2019, 5:39 AM
In edit mode radio button value are not selected
Faridul SagarPosted Sep 4, 2019, 5:28 PM
Thanks a lot, It was really very helpful to me.....
TANKALA SAIPosted Aug 22, 2019, 4:41 AM
I was trying to compile... angular is compling and it was displaying the uI page and DB also created but it was not getting linked to db
BijayKumar AcharyaPosted Aug 20, 2019, 12:56 PM
Can you please update this with Paging, Sorting and nested Grid. Like Details GRid with Paging and sorting in the Child Grid as well.
BijayKumar AcharyaPosted Aug 14, 2019, 6:28 AM
Really a great Article. I am very new to Angular and surprisingly I could run the whole Project with the code you shared. I really appreciate your efforts and knowledge on Angular and Web Api. I must say most of the material I found on Internet you can't run them by own, you need debug and fix but in your case its just executed for a new starter without any bug. ** I would like to request you to extend this program for Search, Sorting, Paging to complete end to end operation** Many Thanks. God bless you.
kevin ouedraogoPosted Jul 6, 2019, 3:57 PM
It looks like this line of code is failing WebApiDbEntities objEntity = new WebApiDbEntities(); which library contains WebApiDbEntities class.
kevin ouedraogoPosted Jul 6, 2019, 3:56 PM
WebApiDbEntities objEntity = new WebApiDbEntities();
kevin ouedraogoPosted Jul 6, 2019, 3:56 PM
Hi it looks like this line in the code is failing in the code
kevin ouedraogoPosted Jul 6, 2019, 3:56 PM
WebApiDbEntities objEntity = new WebApiDbEntities();
Former memberPosted Jun 26, 2019, 3:47 AM
Hi.On localhost angular web api rud working well.But when deploy to firebase not working get/post/delete and other methods.
Former memberPosted Jun 25, 2019, 1:35 AM
THanks for article.I get cors block error when put data.But when fetch no error,but when post data get cors blocked error.
Former memberPosted Jun 19, 2019, 7:59 AM
Nice explanation for beginners Thanks!...
আনিছ আনিছPosted Jun 19, 2019, 6:12 AM
Nice Article for Beginner, Thank you.
Nidhi KumarPosted Jun 4, 2019, 5:32 AM
Hi Mithlesh Nice Article.. I am facing some issue on Table, looks like css is not applying on lower table.. it is not looking similar to your detail table rows and buttons .. Can you please tell why its happening??
Yasser AhmedPosted Jun 2, 2019, 5:21 PM
Hi , if want to debug web api project, how can i do it
Damodaran NPosted May 21, 2019, 2:03 AM
Hi this is good example..i tried it am faced some issues in DateOfBirth DATE declaration in employee model class in VC. And also gender values saved in DB with empty space example "0 ". In this case i seen correct values while insert data in SaveChanges method. So kindly do the needful.
derek rockPosted Apr 12, 2019, 8:15 AM
Fyi there are a couple of errors you will get if the database table is not setup correctly. System.Data.Entity.Core.OptimisticConcurrencyException and Cannot insert the value NULL into column column does not allow nulls insert failsyou need to create the table using the following script. CREATE TABLE EmployeeDetails ( EmpId INT PRIMARY KEY IDENTITY(1,1), EmpName VARCHAR(50) , DateOfBirth DATE, EmailId VARCHAR(50), Gender NCHAR(10), Address VARCHAR(100), PinCode VARCHAR(50) )
derek rockPosted Apr 11, 2019, 2:19 PM
Hi Mithilesh. Great tutorial, Getting a SqlException: Cannot insert the value NULL into column 'EmpId', table 'Test.dbo.EmployeeDetails'; column does not allow nulls. This does not happen on update, only insert. Any ideas? Thank You in Advance!
Nayeem MansooriPosted Apr 3, 2019, 3:54 AM
Nice....thankyou sir..
Hamid KhanPosted Mar 20, 2019, 6:49 AM
Good explanation for CRUD.................
Mohamed IbrahimPosted Mar 10, 2019, 3:51 PM
Nice explanation. thanks for sharing... IS there any tool to debug the code in angular
NTDP MurthyPosted Mar 4, 2019, 5:54 AM
How to get value from mat-radio-button tag after clicking getEmployeeById()
JacobPosted Mar 1, 2019, 3:01 PM
Would you happen to know why the imported material theme does not apply to the table?
Junior FerreiraPosted Feb 21, 2019, 12:15 PM
Import { Lancamento } from './lancamento.model';Export class Employee { EmpId: string; EmpName: string; DateOfBirth: Date; EmailId: string; Gender: string; Address: string; PinCode: string; public lancamentos?: Lancamento[], } what would a combobox look like if it had a relationship?
Somnath AgwanPosted Feb 12, 2019, 7:30 AM
Nice! but can you provide scrolling functionality to this table.
Uma PlPosted Feb 7, 2019, 7:22 AM
Please give an example with login functionality also
First LastPosted Jan 7, 2019, 9:42 AM
When developing, what is it called and what is refreshing the page automatically when a component is changed?
First LastPosted Jan 7, 2019, 8:35 AM
After an employee is successfully created, the UI entry fields are red as though there is an error. I see int the CreateEmployee(), that after the creation, you call the this.employeeForm.reset();. Should that not reset them the fields so that they are NOT red? Is seems to think that the fields have been 'touched'.
First LastPosted Jan 6, 2019, 3:16 PM
Note: please mention that you need to run the web api and leave it running. Then take the localhost # and update the URL in the employee.service.ts with the value. url = "http://localhost:56009/Api/Employee"; Then run the Angular app.
sreenivasa kPosted Jan 3, 2019, 4:41 PM
Nice article. thanks for sharing
shaik rahamtullaPosted Jan 3, 2019, 8:18 AM
Very cool explanation..