section 1
import { Component } from '@angular/core';
@Component({
selector: 'app-section1',
template:
`
<button (click)="submit()"></button>
`
})
export class Section {
constructor() {
}
someFunction(): void {
}
}
section 2
import { Component } from '@angular/core';
@Component({
selector: 'app-section2',
template:
`
<p>text</p>
`
})
export class Section2 {
constructor() {
}
}
i want to call the section 1 someFunction() from section 2
section 1 and section 2 haven't any direct relation.
is there a way to access the instance of section 1 in section 2
in JavaScript, something like this
MyClass myClass = applicationContext.getBean("myClass");
is there any possible way like this in angular without using BehaviorSubject
or EventEmitter
?