ahmed elbarbary

ahmed elbarbary

  • NA
  • 1.6k
  • 278.5k

How to display count green color if value > 0 and red if < ?

Feb 1 2020 7:09 PM
How to display  green color if count parts for product > 0 and red if  count parts for product is < 0 ?
 
I already have web api function do count for parts related to product based on name of product pass to it
 
suppose I pass car to web api function
 
then it will return how many parts exist on product table  that car contain it
 
so if product table have many parts on table product then count will be bigger from 0
 
then it will show count as green 
 
and if is count equal 0 then it will count returned as red for product  
 
so my url return integer value as 5 represent number of parts for product
 
and may be 0 that mean no parts for product 
 
How to display count by color green if count more than 0 
and red if less than 0 
 
How to write service and component.ts and component view by angular 7
 
service 
localhost:5050/api/countparts/Car it will return integer value
component.ts
how to display returned value when bigger than 0 then green else equal then red
on component.html 
5 green
0 red
 
 
 

Answers (2)