0

I have defined one method in one component. I want to use that method in another component. Basically Export and Import but I don't how to do it with method.

abc.component.ts

import { Component, OnInit } from '@angular/core';
export class ABCComponent {

    getUser(){
        //Some code
    }
}

def.component.ts

import { Component, OnInit } from '@angular/core';
import { ABCComponent } from '../../abc.component.ts';
export class DEFComponent implements OnInit {
    ngOnit(){
        //I want to use getUser method here from abc.component.ts
    }
}
daedsidog
  • 1,732
  • 2
  • 17
  • 36
Chris
  • 1,236
  • 2
  • 18
  • 34

0 Answers0