के अंदर काम नहीं कर रहा है मेरा ngOndestroy अन्य मार्ग नेविगेशन के साथ कॉल कर रहा है लेकिन यह विधि के अंदर स्पष्ट अंतराल निष्पादित नहीं कर रहा है। मैं इसे गलत कहां बना रहा हूं? यह पृष्ठभूमि में चल रहा है जबकि मैं अन्य घटक में हूं।clearinterval ngOnDestroy()
timer:any;
ngOnInit() {
this.timer= this.interval();
};
ngOnDestroy(){
clearInterval(this.timer);
console.log("Inside Destroy");
}
interval(){
setInterval(()=>{
this.getData();
},20000)
}
getData(){
this.dataservice.getdata()
.subscribe(users=>{
this.datas=users;
console.log(this.datas);
})
}
धन्यवाद zgue और patryk। यह मेरे लिए काम किया। तुम लड़के गजब हो। एक टन धन्यवाद –