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
}
}