Stack Exchange
Dependency Injection in Angular
I have 2 file services (data-parent.service.ts, data-child.service.ts). Both have a() function names. data-child.service.ts extends data-child.service.ts. 
app-root.component.ts
@Component({
    selector: 'app-root',
    templateUrl: './app-root.component.html',
    styleUrls: ['./app-root.component.scss']
})
export class AppRoot extends DataParent{
    clicka = () => {
        console.log('click a');
        this.a();
   }
}

data-parent.service.ts
@Injectable()
export class DataParent{
    a(): void {
        console.log('a DataParent');
    }
}

data-child.service.ts
@Injectable()
export class DataChild extends DataParent {
   a = () => {
      console.log('a DataChild');
      super.a();
   }
}

How to do this when the app-root component calls function name a () of data-child.service.ts, the function a () of data-child.service.ts executes.
Result: "click a"
"a DataChild"
"a DataParent"

please add some code!

https://stackoverflow.com/help/mcve

creating a new instance instead of relying on the dependency injection would do the job for you, but this is not the only way. I have pasted the code snippet below for your reference to see all the possibilities.
import { Component, OnInit } from '@angular/core';
import { ChildServiceService } from './child-service.service';
import { ParentServiceService } from './parent-service.service';

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
  constructor(private childService: ChildServiceService, private parentService: ParentServiceService) { }
  title = 'app';
  childNewService: any;
  parentNewService: any;
  ngOnInit(){
    this.childNewService = new ChildServiceService();
    this.parentNewService = new ParentServiceService();
    this.childService.callService();
    this.parentService.callService();
    this.childNewService.callService();
    this.parentNewService.callService();
  }

}

import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class ParentServiceService {

  callService(){
    console.log('Inside Parent Service');
  }
}

import { Injectable } from '@angular/core';
import { ParentServiceService } from './parent-service.service';

@Injectable({
  providedIn: 'root'
})
export class ChildServiceService extends ParentServiceService{

   callService(){
     console.log('Inside Child Service');
   }


}


tks. But i want when I call this.parentService.callService() then callService() of ChildServiceService executes then to callService() of ParentServiceService execute.

In your constructor(){} in app-root component   you can use Dependency Injection in Angular
    constructor(private dataParentService: DataParentService(or your class name of data-parent.service.ts) , 
                private dataChildService: DataChildService(or your class name of data-child.service.ts)) {}

Than you can use both function Example:
 myfunction(){
  this.dataParentService.a() {
    this.dataChildService.a()
  }
}

EDIT: try this :
 myfunction(){
  this.dataChildService.a() {
    this.dataParentService.a()
  }
}

EDIT#2:
    @Component({
        selector: 'app-root',
        templateUrl: './app-root.component.html',
        styleUrls: ['./app-root.component.scss']
    })
    export class AppRoot extends DataParent{
        constructor(private dataParentService: DataParentService(or your class name of data-parent.service.ts) , 
                    private dataChildService: DataChildService(or your class name of data-child.service.ts)) {}
        clicka() {
          this.dataChildService.a() {
          this.dataParentService.a()
         }
      }
    }

ALSO you need to import you services in Top of ts file your controller

Give  me please screen or something error that i can help you!

desired results:  "click a" "a DataChild" "a DataParent"  according to the above code

I dont understand you, sorry.Plz tell me some other way what you need

You mean first need func from DataChild than func from DataParent ?

I'm really sorry. when executing the clicka(), I want the console result to be "click a" "a DataChild" "a DataParent"

You mean first need func from DataChild than func from DataParent ? => Exactly. I want the function in ChildParent to be called before the function at DataParent

Check my EDIT2 plz

thanks you very much. but now i can't take screenshots. Still faulty ';' expected.
