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,644
  • 2
  • 13
  • 34
Chris
  • 1,130
  • 2
  • 15
  • 32

0 Answers0