exportclassDetailsComponent{// Store Dataid:string;blogDetails:any=null;// SubscriptionsprivatesubGetData1:Subscription;privatesubRouteData1:Subscription;// InjectprivatereadonlyactivateRoute=inject(ActivatedRoute);privatereadonlyblogService=inject(BlogService);ngOnInit():void{// GET DATA FROM PARAMthis.subRouteData1=this.activateRoute.paramMap.subscribe(param=>{this.id=param.get('id');if (this.id){this.getArticleById(this.id);}});}/**
* HTTP REQ HANDLE
* getAllProductMenu()
*/privategetArticleById(id:any){this.subGetData1=this.blogService.getArticleById(id).subscribe({next:res=>{this.blogDetails=res;// console.log("blogDetails", this.blogDetails);},error:err=>{console.log(err);}})}/**
* On Destroy
*/ngOnDestroy(){if (this.subGetData1){this.subGetData1.unsubscribe();}if (this.subRouteData1){this.subRouteData1.unsubscribe();}}}
Top comments (0)
Subscribe
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)