I have two components, Among those two, one component is acting as a provider. how we can access all methods from component A to its provider.
import { Component, ElementRef, HostListener, Input, OnInit, ViewChild } from '@angular/core';
import { FormBuilder, FormGroup } from '@angular/forms';
import { NewParcelModal } from './new-parcel-modal';
@Component({
  selector: 'app-add-new-parcels',
  templateUrl: './add-new-parcels.component.html',
  styleUrls: ['./add-new-parcels.component.scss'],
  providers: [NewParcelModal, MomentDateFormatter]
})
export class AddNewParcelsComponent implements OnInit {
 
  ngOnInit() {
    this.getWindowsProperties();
    this.createControls();
    this.addNewParcelForm.patchValue(this.modalInfo);
    this.getNoticeTypeList();
  }
  @HostListener('window:resize', ['$event'])
  onResize(event) {
    this.getWindowsProperties();
  }
 
  createControls() {
    this.addNewParcelForm = this.formBuilder.group(this.newParcelModal.parcelInfo)
  }
  getSurveyTypes() {
    return { test: 'test' };
  }
}
Provider component
import { Injectable } from "@angular/core";
import { bind } from "@angular/core/src/render3";
import { FormControl, Validators } from "@angular/forms";
import { DISABLED } from "@angular/forms/src/model";
import { CONSTANTS } from "src/app/common/constants";
@Injectable()
export class NewParcelModal {
    constructor() { }
    parcelInfo = {       
        royaltyrate: new FormControl(null),
        percentinterest: new FormControl(null)    
        };
}
I am using NewParcelModal as provider in the component AddNewParcelsComponent
Problem: Not able to aceess getSurveyTypes method from AddNewParcelsComponent in the NewParcelModal component.
 
     
    