title: Property emit does not exist on type
body: <p>I tried to pass the data from one component to another via Subject through services,and i received the following error</p>
  
  <p><strong>Property 'emit' does not exist on type 'Subject(any)'.</strong></p>
  
  <p>so here is what i tried</p>
  
  <p>component.ts file</p>
  
  <pre><code>import { Component, OnInit } from '@angular/core';
  import { Productservice } from 'src/app/services/products.service';
  import { Router, ActivatedRoute } from '@angular/router';
  
  
  @Component({
  selector: 'app-admin-products',
  templateUrl: './admin-products.component.html',
  styleUrls: ['./admin-products.component.scss']
  })
  export class AdminProductsComponent implements OnInit {
  listofproducts
  editedproduct
  constructor(private prservice:Productservice,private 
  router:Router,private route:ActivatedRoute) { 
  
  }
  
  ngOnInit() {
  this.listofproducts=this.prservice.getallproducts()
  
  
  }
  
  
  
  
  onclickedit(id){
  
  this.editedproduct=this.prservice.getspecificproduct(id)
  this.prservice.editproduct.emit(this.editedproduct)
  this.router.navigate(['edit',id],{relativeTo:this.route})
  }
  
  }
  </code></pre>
  
  <p>so here in emit it says <strong>Property 'emit' does not exist on type 'Subject(any)</strong></p>
  
  <p>service file</p>
  
  <pre><code>import { Subject } from "rxjs";
  import { Items } from "../home/header/admin-products/items.modal";
  
  export class Productservice{
  
  productcard=new Subject&lt;any&gt;()
  
  editproduct=new Subject&lt;any&gt;()
  
  
  
  
  
  getallproducts(){
      return this.cards
  }
  getspecificproduct(id){
      return this.cards[id]
  }
  
  } 
  </code></pre>
  
  <p>Here is the component where i subscribed it</p>
  
  <pre><code>import { Component, OnInit, Input } from '@angular/core';
  import { Productservice } from 'src/app/services/products.service';
  import { Router, ActivatedRoute } from '@angular/router';
  import { take } from 'rxjs/operators';
  
  @Component({
  selector: 'app-edit-products',
  templateUrl: './edit-products.component.html',
  styleUrls: ['./edit-products.component.scss']
  })
  export class EditProductsComponent implements OnInit {
  id:number
  constructor(private prservice:Productservice,private 
  router:Router,private route:ActivatedRoute) { }
  
  ngOnInit() {
  
  this.route.params.subscribe(
    (params)=&gt;{
      this.id=+params['id']
      console.log(this.id)
    }
  )
  this.prservice.editproduct.pipe(take(1)).subscribe(
    (editproductdetails)=&gt;{
      console.log(editproductdetails)
    }
  )
  
  }
  
  }
  </code></pre>