Access component One method from component Two

oneComponent

  ngOnInit() {}

  public call(){
    alert("Hello!!");    
  }

twoComponent

import { oneComponent } from '../one.component';

@Component({
  providers:[oneComponent],
  selector: 'app-two',
  templateUrl: ...
}


constructor(private compOne: oneComponent ) { }

public callFunc() {
    this.compOne.call();
  }

 

componentTwo html file

<button (click)="callFunc()">click</button>