import { Component, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; import { create } from 'domain'; import { ViewdataService } from '../service/viewdata.service'; import { catagory } from '../../catagory'; import { AuthService } from '@app/shared/services'; @Component({ selector: 'app-viewdata', templateUrl: './viewdata.component.html', styleUrls: ['./viewdata.component.css'] }) export class ViewdataComponent implements OnInit { constructor(private route: ActivatedRoute, private reviewdataService: ViewdataService,private authService: AuthService) { } dataId: any; data: any; user_data: any; catagorys = catagory; ngOnInit(): void { this.authService.getUser().subscribe(data => this.user_data = data); this.route.paramMap.subscribe(params => { this.dataId = params.get('dataId'); }); this.reviewdataService.getReviewsById(this.dataId).subscribe(response => { this.data = response[0]; console.warn(this.data); }); } }