Delete event not call from angular where as get method calls

Delete event not call from angular where as get method calls

I have created the web API for countries and try to access it from angular 7, the get details and get record by id is working fine where as Delete method not working.

I have created the web API for countries and try to access it from angular 7, the get details and get record by id is working fine where as Delete method not working.

when i try to access Delete there is no call send to web API from angular 7.

// DELETE: api/Country/5
[HttpDelete("{id}")]
public IActionResult Delete(long id) {
 Country country = _dataRepository.Get(id);
 if (country == null) {
  return NotFound("The Employee record couldn't be found.");
 }

_dataRepository.Delete(country); return NoContent(); }

// GET: api/Countries [HttpGet] public IActionResult Get() { IEnumerable < Country > country = _dataRepository.GetAll(); return Ok(country); }

// GET: api/Country/5 [HttpGet("{id}", Name = "Get")] public IActionResult Get(long id) { Country country = _dataRepository.Get(id);

if (country == null) { return NotFound("The Employee record couldn't be found."); }

return Ok(country); }

export class CountriesComponent {

public countries: Country[];

bUrl = 'https://localhost:44324/';

constructor(private http: HttpClient, private router: Router) {

this.http.get&lt;Country[]&gt;(this.bUrl + 'api/country').subscribe(result =&gt; {
  this.countries = result;
}, error =&gt; console.error(error));

}

btnClick = function (id) { this.router.navigateByUrl('/country-edit/' + id); };

btnDelete = function (id) { return this.http.delete(this.bUrl + 'api/Country/' + id); // return this.http.get<Country[]>(this.bUrl + 'api/country/'+ id).subscribe(result => { // this.countries = result; // }, error => console.error(error)); } }


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

C/C++ vs. Rust: A developer’s perspective

In this post, you'll see the difference between Rust and C/C++ in a developer’s perspective

Linq Many to many in Entity Framework core

I have classes for building many to many relationships.