Click here to Skip to main content
15,868,004 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
problem

How to display count of records on tables using angular 7 ?

I work on SQL server 2012 and asp.net core 2.2

I make web API on .net core 2.2 return count of records on table

meaning function API return only one value as integer

my question

How to display count of items on angular 7 ?

localhost:8089/api/countitems

on apiservice.ts

How to receive count from link below

ocalhost:8089/api/countitems

on itemsComponent.ts

How to call service here and receive count

itemsComponent.html

how to display count here on div or label


What I have tried:

export class AppComponent implements OnInit  {

  constructor() {
    
 }
 
 ngOnInit(){
  // how to call count here then display on html component
  }
}
Posted
Updated 22-Feb-20 23:04pm

1 solution

SQL
SELECT COUNT([Id]) AS 'Count' FROM [TheTable];
 
Share this answer
 
Comments
ahmed_sa 23-Feb-20 5:19am    
no i dont need that i need it on angular 7 what i do to receive value of count
my API return number as 100
how to receive on angular 7 and display on component.html
phil.o 23-Feb-20 5:25am    
You should search for a tutorial on angular 7. This is a quick answers forum, it is not meant for us to write a full tutorial solely based on vague requirements.
angular 7 tutorial

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900