hi,
 
i have problem in each click on the button it returns to me the result I want after the click and show me result after the inputs will be emptied it shows me nothing
 
 
here is a descriptive picture of the problem
 
app.component.ts
- import { Component,OnInit } from '@angular/core';  
-   
-   
-   
-   
- @Component({  
-   selector: 'app-root',  
-   templateUrl: './app.component.html'  
- })  
- export class AppComponent   
- {  
-     firstdate:Date;  
-     lastdate:Date;  
-     filterdata:any;  
-     dateCheck(fDate:Date,lDate:Date)   
-     {  
-         if(this.projetList && this.projetList.length)  
-         {  
-             this.projetList.forEach((proj :any) => {  
-             if (proj.datedeb >=fDate && proj.datefin<=lDate)  
-             {  
-                 this.filterdata.push(proj);   
-             }  
-              
-         });  
-         }  
-         return this.filterdata;    
-           
-     }  
-       
-           
-       
-     projetList:any;  
-     constructor()   
-     {  
-         this.filterdata =[];  
-         this.projetList=[  
-             {name:"maroua",lastname:"oumlaz",datedeb:"2015-10-10",datefin:"2016-02-02"},  
-         {name:"yassine",lastname:"oumlaz",datedeb:"2017-11-23",datefin:"2018-01-01"}  
-     ];  
-     }  
-   
-   
-   
-   ngOnInit()   
-   {  
-     /*if (this.globals.user === '' || this.globals.user === null)   
-     {  
-       this.route.navigateByUrl('login/login');  
-     }*/  
-       
-   }  
- }  
app.component.html
- <html>    
- <head>    
- <title>Date before current date</title>    
-     
- </head>    
- <body>    
- <h2>Check if date is between two dates</h2>    
- Enter  first Date(dd/mm/yyyy):    
- <input type="date" name="fDate"  #firstdate /><br/>    
- Enter  second Date(dd/mm/yyyy):    
- <input type="date" name="lDate" #lastdate /><br/>    
- <input type="submit" value="Check" (click)="dateCheck(firstdate.value,lastdate.value);" />    
-     
- <p *ngFor="let pr of filterdata">    
- {{pr.name}}    
- </p>    
- </body>    
- </html>